I need to stop(cancel) current .fadeIn(5000) and start the same fadeIn from the beginning, once a button is clicked (otherwise next fadeIn will start only after 5000). How can I check, if div is actively fading and how to can cancel it (I assume I could just .hide())?
Use .stop()
. You don't need to test if fadeIn
is running, if it is not, stop
has not effect.
You still have to hide it though. So it would be something like:
$('selector').stop(true).hide().fadeIn(5000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With