aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
authorlouisremi <louisremi@louisremi-laptop.(none)>2011-01-31 18:57:23 +0100
committertimmywil <tim.willison@thisismedium.com>2011-04-04 15:46:37 -0400
commitf7ccec1b70a42de21b55dbb7b3d65da5628ade9e (patch)
treee1a02fd41d41eab3bf517c2eb3e2e44d6e8bc6f2 /src/effects.js
parent2ed81b44be958b5f2b5569ab15f22bde262b4eb6 (diff)
downloadjquery-f7ccec1b70a42de21b55dbb7b3d65da5628ade9e.tar.gz
jquery-f7ccec1b70a42de21b55dbb7b3d65da5628ade9e.zip
use requestAnimationFrame instead of setInterval for animations, when available.
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/effects.js b/src/effects.js
index d9e9a8b31..a41efc282 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -363,7 +363,9 @@ jQuery.fx.prototype = {
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval(fx.tick, fx.interval);
+ jQuery.support.requestAnimationFrame ?
+ window[jQuery.support.requestAnimationFrame](fx.tick):
+ timerId = setInterval(fx.tick, fx.interval);
}
},
@@ -468,6 +470,8 @@ jQuery.extend( jQuery.fx, {
if ( !timers.length ) {
jQuery.fx.stop();
+ } else if ( jQuery.support.requestAnimationFrame ) {
+ window[jQuery.support.requestAnimationFrame](this);
}
},