Skip to content
Permalink
Browse files

use requestAnimationFrame instead of setInterval for animations, when…

… available.
  • Loading branch information
louisremi timmywil
louisremi authored and timmywil committed Jan 31, 2011
1 parent 2ed81b4 commit f7ccec1b70a42de21b55dbb7b3d65da5628ade9e
Showing with 13 additions and 1 deletion.
  1. +5 −1 src/effects.js
  2. +8 −0 src/support.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);
}
},

@@ -58,6 +58,14 @@
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,

// Verify requestAnimationFrame mechanism existence
// use the prefixed name as the value
requestAnimationFrame: mozRequestAnimationFrame ?
'mozRequestAnimationFrame' :
webkitRequestAnimationFrame ?
'webkitRequestAnimationFrame' :
false,

// Will be defined later
deleteExpando: true,
optDisabled: false,

0 comments on commit f7ccec1

Please sign in to comment.
You can’t perform that action at this time.