I have to use a callback function when a jQuery animation is complete. I've always did that like this:
.animate({ properties }, duration, function() { /* callback */ });
However, when asking a question here I've been proposed a solution with a different syntax.
$('#redirectNoticeContainer').animate({ properties }, { queue: false, duration: 123 });
where am I supposed to put the callback function there? This is my guess, but it is not working.
$('#redirectNoticeContainer').animate({ properties }, { queue: false, duration: 123 }, function () {
console.log("ok");
setTimeout(function () { window.location.replace("/Account/Login"); }, 1200);
});
The animation works. Callback doesn't. Where should I put it?
That form of animate()
takes a complete
option:
$("#redirectNoticeContainer").animate({
// properties...
}, {
queue: false,
duration: 123,
complete: function() {
console.log("ok");
setTimeout(function() {
window.location.replace("/Account/Login");
}, 1200);
}
});
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