use requestAnimationFrame instead of setInterval for animations, when available.
This commit is contained in:
parent
2ed81b44be
commit
f7ccec1b70
2 changed files with 13 additions and 1 deletions
6
src/effects.js
vendored
6
src/effects.js
vendored
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue