这是您的简单 jQuery 滑块/手风琴:
您可以从这里检查(jsfiddle)。
jQuery:
$('div').bind({
click: function() {
$('div').stop().animate({'height':'100px'},600);//600 sets time. 600miliseconds
$(this).stop().animate({'height':'320px'},600);
},
/* if you want to do it with hover effects, just deactive click and use these:
mouseenter: function() {
$('div').stop().animate({'height':'100px'},600);//600 sets time. 600miliseconds
$(this).stop().animate({'height':'320px'},600);
},
mouseleave: function() {
$('div').stop().animate({'height':'100px'},600);
}
*/
});
html:
<div>
<img src="http://www.hurriyet.com.tr/_np/7181/17287181.jpg" />
</div>
<div>
<img src="http://www.hurriyet.com.tr/_np/2790/17282790.jpg" />
</div>
<div>
<img src="http://www.hurriyet.com.tr/_np/6751/17286751.jpg" />
</div>
<div>
<img src="http://www.hurriyet.com.tr/_np/7203/17287203.jpg" />
</div>
CSS:
div { overflow:hidden; float:left; height:100px; margin:0 5px; border-bottom: 1px solid #000; }
注意:你可以在任何东西上使用它,只需要初始化 jQuery (: