]> source.dussan.org Git - jquery.git/commitdiff
Fix #1827 bug where extra setInterval()s can be called during animation.
authorDavid Serduke <davidserduke@gmail.com>
Fri, 16 Nov 2007 21:50:27 +0000 (21:50 +0000)
committerDavid Serduke <davidserduke@gmail.com>
Fri, 16 Nov 2007 21:50:27 +0000 (21:50 +0000)
src/fx.js

index 711825f9941fed8d6a146bffa46927acb97f5b42..e4c1015611948bde659ceb1b972829e2adcf4473 100644 (file)
--- a/src/fx.js
+++ b/src/fx.js
@@ -222,6 +222,7 @@ jQuery.extend({
        },
        
        timers: [],
+       timerId: null,
 
        fx: function( elem, options, prop ){
                this.options = options;
@@ -276,16 +277,18 @@ jQuery.fx.prototype = {
 
                jQuery.timers.push(t);
 
-               if ( jQuery.timers.length == 1 ) {
-                       var timer = setInterval(function(){
+               if ( jQuery.timerId == null ) {
+                       jQuery.timerId = setInterval(function(){
                                var timers = jQuery.timers;
                                
                                for ( var i = 0; i < timers.length; i++ )
                                        if ( !timers[i]() )
                                                timers.splice(i--, 1);
 
-                               if ( !timers.length )
-                                       clearInterval( timer );
+                               if ( !timers.length ) {
+                                       clearInterval( jQuery.timerId );
+                                       jQuery.timerId = null;
+                               }
                        }, 13);
                }
        },