1. use hover or mouseenter + mouseleave
2. use stop(true, true) to Stop the currently-running animation on the matched elements. (.stop( [clearQueue] [, jumpToEnd] ))
2. use stop(true, true) to Stop the currently-running animation on the matched elements. (.stop( [clearQueue] [, jumpToEnd] ))
$(document).ready(function(){
$('li.mainlevel').hover(function(){
$(this).find('ul').stop(true, true).slideDown();//you can give it a speed
}, function(){
$(this).find('ul').stop(true, true).slideUp();
});
});

本文介绍如何利用hover和mouseleave事件结合stop方法来控制元素的滑动动画,实现元素平滑展开和收起的效果。

被折叠的 条评论
为什么被折叠?



