2012-02-14 99 views
1

我有以下的动画:停止jQuery的动画循环

http://jsfiddle.net/jtqcj/2/

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); 
}); 

如何停止从排队效果的动画,如果你的鼠标关闭,在快速连续多次。

+0

更好地重复:http://stackoverflow.com/questions/9113568/jquery-stop-repeating-animation-on-multiple-rollovers – 2012-02-14 12:48:00

回答

6
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); 
}); 

});​ 
+0

该死!打我30秒! – YonoRan 2012-02-14 12:48:35

+1

:)我是最快的家伙;) – Yorgo 2012-02-14 12:49:07

+1

有人在几天前回答了同一个问题的问题...你们都松了;) – 2012-02-14 12:51:52