Vince P
Vince P

Reputation: 1791

Stopping jQuery animation loop

I have the following animation:

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.

Upvotes: 1

Views: 205

Answers (1)

Yorgo
Yorgo

Reputation: 2678

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

});​

Upvotes: 6

Related Questions