我需要建立一個搜索欄,其中包含搜索輸入,一個選項按鈕,然後是第三個按鈕,當徘徊擴展到左側時,將前兩個元素向前推。在搜索欄中滑動嵌套的Div
我試圖用CSS來做到這一點,但不能讓其他元素很好地滑動,所以我猜這需要用jQuery來完成?
當用戶將鼠標懸停在箭頭上時,div會向左滑動以顯示「搜索」一詞以及20%灰色疊加層。
'選項'按鈕應向左滑動,同時搜索按鈕展開,但整個搜索包裝的寬度不應改變也不應移動。
在代碼而言,這是我在目前位置:
HTML:我試過
<div class="search-box">
<input name="" type="text" placeholder="search" class="input"><a href="#" class="option">options</a>
<div id="search-button">
<div id="search-button-text">search </div>
<a href="#"><img src="/static/images/search-btn.jpg" alt=""></a>
</div>
</div>
一些JS沒有運氣:
$(".search-button").hover(function() {
$('search-button-text').style.display = 'block-inline';
});
的CSS:
.search-box {
width:582px;
float:right;
clear:both;
}
.search-box .input {
float:left;
/*min-width: 500px;*/
border:1px solid #231f20;
height:25px !important;
font:16px "JosefinSans Regular", Arial, Helvetica, sans-serif;
margin:0px;
}
.search-box .option {
display: block-inline;
float:left;
height:20px !important;
width: 50px;
border:1px solid #231f20;
padding-top:7px;
text-align: center;
border-left:none;
border-right:none;
color:#000;
text-decoration:none;
font-size:13px;
}
#search-button {
display:inline-block;
}
#search-button-text {
display: none;
visibility: hidden;
}
我認爲我們需要的CSS也是這樣的 –
對不起,忘了包括。 – xXPhenom22Xx
你試過'.animate({width:'toggle'});'??? –