我已经创建搜索框与搜索按钮,但我希望搜索框只有当我点击搜索按钮与动画(切换或其他...)像http://prntscr.com/tijo4,网站:http://thenextweb.com/可见。如何在点击按钮上动画搜索框?
我已经试过只有这个:http://jsfiddle.net/JHdzd
HTML:
<div id="search">
<input title="Search for..." id="forsearch" type="text" class="forsearch_products">
<input class="search-button" type="submit" value="Search">
</div>
CSS:
#search {
width: 250px;
height: 28px;
background-color: #C7D7E8;
padding: 6px 0 6px 0px;
}
input#forsearch.forsearch_products {
width: 135px;
height: 18px;
border: 2px solid #6B9DD3;
margin: 0 3px 0 8px;
float: left;
padding: 3px;
}
input.search-button {
width: 85px;
height: 28px;
border: 1px solid white;
font-size: 12px;
display: block;
float: left;
font-weight: bold;
color: white;
background: rgb(237,173,113);
}
如果在本地JavaScript这样做,那么'setInterval'功能是你应该看看。如果你可以使用像jQuery/Dojo/MooTools /等库,这个问题就变得微不足道了。 – Default 2013-02-20 21:54:46
@默认我在网站上使用jQuery,但我不是很熟悉自定义js – 2013-02-20 22:00:08