Here is a solution that might work.
try creating a new transition function that queues an additional callback. This callback can be cleared after the animation is canceled by stopping. Cleaning and skipping instructions However, stops from the old function are not accepted. But for this we can create a new stop function. It is simply printed in a browser and not fully verified.
(function($){
$.fn.stopableTransition = function (...){
var skip = false
var clear = false
this.handle("stopTransition", function(doclear, doskip){
skip = doskip; clear = doclear;
})
this.transition(...)
this.queue(function(){
if(skip){
}
else
{
}
if(clear){
skip = false
clear = false
$(this).clearQueue()
}
else
{
skip = false
clear = false
$(this).dequeue()
}
})
}
$.fn.stopTransition = function (clear, skip){
clear = (typeof(clear) === 'undefined') ? false : clear;
skip = (typeof(skip) === 'undefined') ? false : skip;
this.triggerHandler("stopTransition", [clear, skip])
this.dequeue();
}
})(jQuery)
source
share