diff options
Diffstat (limited to 'src/effects.js')
-rw-r--r-- | src/effects.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/effects.js b/src/effects.js index 727c1a7a9..976fe765b 100644 --- a/src/effects.js +++ b/src/effects.js @@ -350,7 +350,8 @@ jQuery.fx.prototype = { // Start an animation from one number to another custom: function( from, to, unit ) { var self = this, - fx = jQuery.fx; + fx = jQuery.fx, + raf; this.startTime = jQuery.now(); this.start = from; @@ -369,13 +370,14 @@ jQuery.fx.prototype = { // Use requestAnimationFrame instead of setInterval if available if ( requestAnimationFrame ) { timerId = 1; - requestAnimationFrame(function raf() { + raf = function() { // When timerId gets set to null at any point, this stops if ( timerId ) { requestAnimationFrame( raf ); fx.tick(); } - }); + }; + requestAnimationFrame( raf ); } else { timerId = setInterval( fx.tick, fx.interval ); } |