aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-04-10 17:17:34 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-10 17:17:34 -0400
commit791402b4536b8c5cbfeaf27d0a3c639cdb9fd192 (patch)
tree4cfb7936b8297ac3bea39e843e5d25b385f5cd23 /src/effects.js
parent9db18ddd84adf63166f411a4f2c776b51d1840e0 (diff)
downloadjquery-791402b4536b8c5cbfeaf27d0a3c639cdb9fd192.tar.gz
jquery-791402b4536b8c5cbfeaf27d0a3c639cdb9fd192.zip
Separate raf function definition from passing it to requestAnimationFrame
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js8
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 );
}