mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
use requestAnimationFrame instead of setInterval for animations, when available.
This commit is contained in:
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);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user