Merge branch 'master' of github.com:jquery/jquery
This commit is contained in:
commit
4c3aba9a15
17 changed files with 902 additions and 373 deletions
23
src/effects.js
vendored
23
src/effects.js
vendored
|
@ -12,7 +12,10 @@ var elemdisplay = {},
|
|||
// opacity animations
|
||||
[ "opacity" ]
|
||||
],
|
||||
fxNow;
|
||||
fxNow,
|
||||
requestAnimationFrame = window.webkitRequestAnimationFrame ||
|
||||
window.mozRequestAnimationFrame ||
|
||||
window.oRequestAnimationFrame;
|
||||
|
||||
function clearFxNow() {
|
||||
fxNow = undefined;
|
||||
|
@ -368,7 +371,8 @@ jQuery.fx.prototype = {
|
|||
// Start an animation from one number to another
|
||||
custom: function( from, to, unit ) {
|
||||
var self = this,
|
||||
fx = jQuery.fx;
|
||||
fx = jQuery.fx,
|
||||
raf;
|
||||
|
||||
this.startTime = fxNow || createFxNow();
|
||||
this.start = from;
|
||||
|
@ -384,7 +388,20 @@ jQuery.fx.prototype = {
|
|||
t.elem = this.elem;
|
||||
|
||||
if ( t() && jQuery.timers.push(t) && !timerId ) {
|
||||
timerId = setInterval(fx.tick, fx.interval);
|
||||
// Use requestAnimationFrame instead of setInterval if available
|
||||
if ( requestAnimationFrame ) {
|
||||
timerId = 1;
|
||||
raf = function() {
|
||||
// When timerId gets set to null at any point, this stops
|
||||
if ( timerId ) {
|
||||
requestAnimationFrame( raf );
|
||||
fx.tick();
|
||||
}
|
||||
};
|
||||
requestAnimationFrame( raf );
|
||||
} else {
|
||||
timerId = setInterval( fx.tick, fx.interval );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue