jQuery , fx . .stop() fx, clearQueue () .
:
function a1(next) {
setTimeout(function () {
alert("one");
next();
}, 1000);
}
function a2(next) {
setTimeout(function () {
alert("two");
next();
}, 1000);
}
$('body').queue('alerts', a1).queue('alerts', a2).dequeue('alerts');
$('body').clearQueue('alerts');
Watch the demo.
source
share