Given the following example: If 5 <li>
elements are found, the callback fires an alert 5 times...
Is there an easy way to find out when the animation is really over and just fire once?
$(this).parent().siblings('li').slideUp(500,function(){
alert
});
$.when($(this).parent().siblings('li').slideUp(500))
.then(function() {
alert('Finished!');
});
Working DEMO
when
docs:
Description: Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
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