I was wondering about what happen to an animation queue promise state when the .stop() function is called on it.
For example:
$('.my-elem')
.stop(true, true)
.animate({})
.promise()
.always(function() {
// do something
})
If the .stop() function get called at any point, what happen to the promise returned earlier ?
Right now, I get the feeling the promise returned just keep on pending forever. Any clue on this ?
Stopping the animation resolves the promise.
//start the anim and alert 'done' on deferred resolution
$('div').animate({height: 500}, 3000).promise().done(function() {
alert('deferred resolved');
});
//interrupt it after 1 second
setTimeout(function() { $('div').stop(); }, 1000);
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