[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
- ];
+ ],
+ requestAnimationFrame = window.webkitRequestAnimationFrame || window.mozRequestionAnimationFrame;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
if ( t() && jQuery.timers.push(t) && !timerId ) {
// Use requestAnimationFrame instead of setInterval if available
- ( timerId = jQuery.support.requestAnimationFrame ) ?
- window[timerId](function raf() {
- // timerId will be true as long as the animation hasn't been stopped
- if (timerId) {
- window[timerId](raf);
+ if ( requestAnimationFrame ) {
+ timerId = 1;
+ requestAnimationFrame(function raf() {
+ // When timerId gets set to null at any point, this stops
+ if ( timerId ) {
+ requestAnimationFrame( raf );
fx.tick();
}
- }):
- timerId = setInterval(fx.tick, fx.interval);
+ });
+ } else {
+ timerId = setInterval( fx.tick, fx.interval );
+ }
}
},
a = div.getElementsByTagName("a")[0],
select = document.createElement("select"),
opt = select.appendChild( document.createElement("option") ),
- input = div.getElementsByTagName("input")[0],
- raf = "RequestAnimationFrame";
+ input = div.getElementsByTagName("input")[0];
// Can't get basic test support
if ( !all || !all.length || !a ) {
// (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:
- window['moz' + raf] ? 'moz' + raf :
- window['webkit' + raf] ? 'webkit' + raf :
- false,
-
// Will be defined later
deleteExpando: true,
optDisabled: false,