【问题标题】:Stopping jQuery animation loop停止 jQuery 动画循环
【发布时间】:2012-02-14 12:44:04
【问题描述】:

我有以下动画:

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

如果您将鼠标快速连续多次悬停,如何阻止动画将效果排队。

【问题讨论】:

标签: jquery


【解决方案1】:
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);
}); 

});​

【讨论】:

  • 该死!比我快 30 秒!
  • 几天前有人回答了同样问题的问题……你们都松了;)
  • @Yorgo 她就是这么说的 :) 对不起,我不得不这样做。 +1
  • 谢谢你 - 非常有帮助:)
猜你喜欢
  • 2011-08-23
  • 1970-01-01
  • 1970-01-01
  • 2012-05-17
  • 2018-02-12
  • 1970-01-01
  • 2013-03-06
  • 1970-01-01
  • 2019-05-03
相关资源
最近更新 更多