X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ffx%2Ffx.js;h=acd51226a5bce153d7930101d2b96d77eff93151;hb=6f064fc9c527a46b4de16f0af310b98d1a87b0f4;hp=af89e93b3a476593abe45d7db270235c3b872fe2;hpb=d7fe34c440b5b52edd0ebabfa942d560e35224f3;p=jquery.git diff --git a/src/fx/fx.js b/src/fx/fx.js index af89e93..acd5122 100644 --- a/src/fx/fx.js +++ b/src/fx/fx.js @@ -110,9 +110,13 @@ jQuery.fn.extend({ toggle: function( fn, fn2 ){ return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle( fn, fn2 ) : - this.animate({ - height: "toggle", width: "toggle", opacity: "toggle" - }, fn, fn2); + fn ? + this.animate({ + height: "toggle", width: "toggle", opacity: "toggle" + }, fn, fn2) : + this.each(function(){ + jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); + }); }, /** @@ -307,16 +311,15 @@ jQuery.fn.extend({ */ animate: function( prop, speed, easing, callback ) { return this.queue(function(){ - var hidden = jQuery(this).is(":hidden"); + var hidden = jQuery(this).is(":hidden"), + opt = jQuery.speed(speed, easing, callback), + self = this; for ( var p in prop ) - if ( prop[p] == "hide" && hidden || - prop[p] == "show" && !hidden ) - return; - + if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) + return jQuery.isFunction(opt.complete) && opt.complete.apply(this); + this.curAnim = jQuery.extend({}, prop); - var opt = jQuery.speed(speed, easing, callback); - var self = this; jQuery.each( prop, function(name, val){ var e = new jQuery.fx( self, opt, name ); @@ -361,7 +364,7 @@ jQuery.extend({ complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, - easing: fn && easing || easing && easing.constructor != Function && easing || "swing" + easing: fn && easing || easing && easing.constructor != Function && easing || (jQuery.easing.swing ? "swing" : "linear") }; opt.duration = (opt.duration && opt.duration.constructor == Number ? @@ -558,7 +561,7 @@ jQuery.extend({ var p = n / options.duration; // Perform the easing function, defaults to swing - z.now = jQuery.easing[options.easing](p, n, firstNum, (lastNum-firstNum), options.duration); + z.now = jQuery.easing[options.easing](p, n, firstNum, (lastNum-firstNum), options.duration); // Perform the next step of the animation z.a();