use requestAnimationFrame instead of setInterval for animations, when available.
This commit is contained in:
parent
2ed81b44be
commit
f7ccec1b70
4
src/effects.js
vendored
4
src/effects.js
vendored
|
@ -363,6 +363,8 @@ jQuery.fx.prototype = {
|
||||||
t.elem = this.elem;
|
t.elem = this.elem;
|
||||||
|
|
||||||
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
||||||
|
jQuery.support.requestAnimationFrame ?
|
||||||
|
window[jQuery.support.requestAnimationFrame](fx.tick):
|
||||||
timerId = setInterval(fx.tick, fx.interval);
|
timerId = setInterval(fx.tick, fx.interval);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -468,6 +470,8 @@ jQuery.extend( jQuery.fx, {
|
||||||
|
|
||||||
if ( !timers.length ) {
|
if ( !timers.length ) {
|
||||||
jQuery.fx.stop();
|
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)
|
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
||||||
optSelected: opt.selected,
|
optSelected: opt.selected,
|
||||||
|
|
||||||
|
// Verify requestAnimationFrame mechanism existence
|
||||||
|
// use the prefixed name as the value
|
||||||
|
requestAnimationFrame: mozRequestAnimationFrame ?
|
||||||
|
'mozRequestAnimationFrame' :
|
||||||
|
webkitRequestAnimationFrame ?
|
||||||
|
'webkitRequestAnimationFrame' :
|
||||||
|
false,
|
||||||
|
|
||||||
// Will be defined later
|
// Will be defined later
|
||||||
deleteExpando: true,
|
deleteExpando: true,
|
||||||
optDisabled: false,
|
optDisabled: false,
|
||||||
|
|
Loading…
Reference in a new issue