aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlouisremi <louisremi@louisremi-laptop.(none)>2011-02-02 11:25:09 +0100
committertimmywil <tim.willison@thisismedium.com>2011-04-04 15:46:37 -0400
commitc95ab2a39c178eee47ce7b1cbdffa812d7914bb6 (patch)
treea688f3768ea66c86cbc273e32de36169a1fbd459 /src
parent15e34d1f07d0c687d040af22dbc66f3978715217 (diff)
downloadjquery-c95ab2a39c178eee47ce7b1cbdffa812d7914bb6.tar.gz
jquery-c95ab2a39c178eee47ce7b1cbdffa812d7914bb6.zip
first tick should not occur immediatly; no tick should happen after a stop()
+ comments
Diffstat (limited to 'src')
-rw-r--r--src/effects.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/effects.js b/src/effects.js
index 12b87bd4e..e5a10295c 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -363,17 +363,16 @@ jQuery.fx.prototype = {
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- if ( jQuery.support.requestAnimationFrame ) {
- timerId = true;
- (function raf() {
+ // Use requestAnimationFrame instead of setInterval if available
+ ( timerId = jQuery.support.requestAnimationFrame ) ?
+ window[timerId](function raf() {
+ // timerId will be true as long as the animation hasn't been stopped
if (timerId) {
- window[jQuery.support.requestAnimationFrame](raf);
+ window[timerId](raf);
+ fx.tick();
}
- fx.tick();
- })();
- } else {
+ }):
timerId = setInterval(fx.tick, fx.interval);
- }
}
},