[ACCEPTED]-How do you cancel a jQuery fadeOut() once it has started?-jquery

Accepted answer
Score: 48
Score: 27

Also, you can test if an element is in the 1 middle of an animation using the :animated selector:

$('#message').mouseover(
    function () {
      if($(this).is(':animated')) {
         $(this).stop().animate({opacity:'100'});
      }
    }
);
Score: 4

In my case stop() merely didn't work at least 9 in Firefox, after searching I figured out 8 that It should be stop(true, true):

$('#message').mouseover(
    function () {
         $(this).stop(true, true).fadeOut();
    }
);

stop(): Stops the currently-running 7 animation on the matched elements.

or even 6 you can use finish() instead:

$('#message').mouseover(
    function () {
         $(this).finish().fadeOut();
    }
);

but there is a side 5 effect about finish(), it stops all other 4 running animations too.

finish(): Stops the 3 currently-running animation, remove all 2 queued animations, and complete all animations 1 for the matched elements.

Read more here.

More Related questions