[ACCEPTED]-How do you cancel a jQuery fadeOut() once it has started?-jquery
Accepted answer
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'});
}
}
);
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.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.