jquery buffer/queue for effects? Or to tell if an effect is in process?
-
06-09-2019 - |
Question
I have a click event that checks to see if a form is correct i.e. filled out details.. and then i call a function that does this
$('#message_text').html(text);
$('#message_system').fadeIn("slow");
$('#message_system').animate({ opacity: 1.0 }, 5000)
.fadeOut('slow', function() {
$(this).hide();
});
All works ok, as long as i wait .. if i double click the button twice for example that it stops displaying ...
I presume if it is hidden hide() then fadeIn() will automatically show it?
Anyone got any experience with this ??
What i probably would like to do is on the second click then disgard current effects and redisplay new messaage
THanks
Solution
I'm not sure if this is what you're after, but have you looked at the stop() method.
You can skip straight to the end of any current animations by calling $('#message_system').stop(true, true)
before beginning again.
OTHER TIPS
if ( ! $(this).is(':animated') ) {
// Do the animation...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow