停止jQuery动画循环 [英] Stopping jQuery animation loop

查看:78
本文介绍了停止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);
}); 

如果您快速连续多次滑过鼠标,如何停止动画对效果的排队.

How do I stop the animation from queuing up the effect if you mouse off and over a number of times in quick succession.

推荐答案

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

});​

这篇关于停止jQuery动画循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆