if ( this.nodeType != 1)
return false;
- var opt = jQuery.extend({}, optall);
- var hidden = jQuery(this).is(":hidden"), self = this;
+ var opt = jQuery.extend({}, optall), p,
+ hidden = jQuery(this).is(":hidden"), self = this;
- for ( var p in prop ) {
+ for ( p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
- return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
+ return jQuery.isFunction(opt.complete) && opt.complete.call(this);
if ( p == "height" || p == "width" ) {
// Store display property
queue(this, type).push( fn );
if ( queue(this, type).length == 1 )
- fn.apply(this);
+ fn.call(this);
}
});
},
});
var queue = function( elem, type, array ) {
- if ( !elem )
- return undefined;
-
- type = type || "fx";
-
- var q = jQuery.data( elem, type + "queue" );
-
- if ( !q || array )
- q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+ if ( elem ){
+
+ type = type || "fx";
+
+ var q = jQuery.data( elem, type + "queue" );
+
+ if ( !q || array )
+ q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) );
+ }
return q;
};
q.shift();
if ( q.length )
- q[0].apply( this );
+ q[0].call( this );
});
};
opt.duration = (opt.duration && opt.duration.constructor == Number ?
opt.duration :
- { slow: 600, fast: 200 }[opt.duration]) || 400;
+ jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def;
// Queueing
opt.old = opt.complete;
if ( opt.queue !== false )
jQuery(this).dequeue();
if ( jQuery.isFunction( opt.old ) )
- opt.old.apply( this );
+ opt.old.call( this );
};
return opt;
// Simple function for setting a style value
update: function(){
if ( this.options.step )
- this.options.step.apply( this.elem, [ this.now, this ] );
+ this.options.step.call( this.elem, this.now, this );
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Start an animation from one number to another
custom: function(from, to, unit){
- this.startTime = (new Date()).getTime();
+ this.startTime = now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
// Each step of an animation
step: function(gotoEnd){
- var t = (new Date()).getTime();
+ var t = now();
if ( gotoEnd || t > this.options.duration + this.startTime ) {
this.now = this.end;
// If a callback was provided, execute it
if ( done && jQuery.isFunction( this.options.complete ) )
// Execute the complete function
- this.options.complete.apply( this.elem );
+ this.options.complete.call( this.elem );
return false;
} else {
};
-jQuery.fx.step = {
- scrollLeft: function(fx){
- fx.elem.scrollLeft = fx.now;
- },
-
- scrollTop: function(fx){
- fx.elem.scrollTop = fx.now;
- },
-
- opacity: function(fx){
- jQuery.attr(fx.elem.style, "opacity", fx.now);
+jQuery.extend( jQuery.fx, {
+ speeds:{
+ slow: 600,
+ fast: 200,
+ def: 400 //default speed
},
-
- _default: function(fx){
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ step: {
+ scrollLeft: function(fx){
+ fx.elem.scrollLeft = fx.now;
+ },
+
+ scrollTop: function(fx){
+ fx.elem.scrollTop = fx.now;
+ },
+
+ opacity: function(fx){
+ jQuery.attr(fx.elem.style, "opacity", fx.now);
+ },
+
+ _default: function(fx){
+ fx.elem.style[ fx.prop ] = fx.now + fx.unit;
+ }
}
-};
+});