mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #1827 bug where extra setInterval()s can be called during animation.
This commit is contained in:
parent
084079d2fd
commit
b9371a6ca4
11
src/fx.js
11
src/fx.js
@ -222,6 +222,7 @@ jQuery.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
timers: [],
|
timers: [],
|
||||||
|
timerId: null,
|
||||||
|
|
||||||
fx: function( elem, options, prop ){
|
fx: function( elem, options, prop ){
|
||||||
this.options = options;
|
this.options = options;
|
||||||
@ -276,16 +277,18 @@ jQuery.fx.prototype = {
|
|||||||
|
|
||||||
jQuery.timers.push(t);
|
jQuery.timers.push(t);
|
||||||
|
|
||||||
if ( jQuery.timers.length == 1 ) {
|
if ( jQuery.timerId == null ) {
|
||||||
var timer = setInterval(function(){
|
jQuery.timerId = setInterval(function(){
|
||||||
var timers = jQuery.timers;
|
var timers = jQuery.timers;
|
||||||
|
|
||||||
for ( var i = 0; i < timers.length; i++ )
|
for ( var i = 0; i < timers.length; i++ )
|
||||||
if ( !timers[i]() )
|
if ( !timers[i]() )
|
||||||
timers.splice(i--, 1);
|
timers.splice(i--, 1);
|
||||||
|
|
||||||
if ( !timers.length )
|
if ( !timers.length ) {
|
||||||
clearInterval( timer );
|
clearInterval( jQuery.timerId );
|
||||||
|
jQuery.timerId = null;
|
||||||
|
}
|
||||||
}, 13);
|
}, 13);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user