停止jQuery的动画循环
问题描述:
我有以下的动画:停止jQuery的动画循环
jQuery("#fp-small-feature-1").mouseenter(function(){
jQuery(".bar").animate({width: "264px"},500);
});
jQuery("#fp-small-feature-1").mouseleave(function(){
jQuery(".bar").animate({width: "0px"},800);
});
如何停止从排队效果的动画,如果你的鼠标关闭,在快速连续多次。
答
jQuery(document).ready(function(){
jQuery("#fp-small-feature-1").mouseenter(function(){
jQuery(".bar").stop().animate({width: "264px"},500);
});
jQuery("#fp-small-feature-1").mouseleave(function(){
jQuery(".bar").stop().animate({width: "0px"},800);
});
});
更好地重复:http://stackoverflow.com/questions/9113568/jquery-stop-repeating-animation-on-multiple-rollovers – 2012-02-14 12:48:00