X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Ffx%2Ffx.js;h=789220f11574ce012af3814a7641eef7c3adc723;hb=5a6029c9fe3618a6cc6b43356598ee4bfc4c2f2a;hp=b8d3d37d7be20cd16f3115fe5e7a74eefa4730d0;hpb=06c185321c4d6feea0894146db0547caf9b4768a;p=jquery.git diff --git a/src/fx/fx.js b/src/fx/fx.js index b8d3d37..789220f 100644 --- a/src/fx/fx.js +++ b/src/fx/fx.js @@ -305,14 +305,6 @@ jQuery.fn.extend({ * left: 50, opacity: 'show' * }, 500); * - * @test stop(); - * var hash = {opacity: 'show'}; - * var hashCopy = $.extend({}, hash); - * $('#foo').animate(hash, 'fast', function() { - * ok( hash.opacity == hashCopy.opacity, 'Check if animate changed the hash parameter' ); - * start(); - * }); - * * @name animate * @type jQuery * @param Hash params A set of style attributes that you wish to animate, and to what end. @@ -492,6 +484,30 @@ jQuery.extend({ // Begin the animation z.custom(z.el.orig[prop], 0); }; + + //Simple 'toggle' function + z.toggle = function() { + if ( !z.el.orig ) z.el.orig = {}; + + // Remember where we started, so that we can go back to it later + z.el.orig[prop] = this.cur(); + + if(oldDisplay == 'none') { + z.o.show = true; + + // Stupid IE, look what you made me do + if ( prop != "opacity" ) + y[prop] = "1px"; + + // Begin the animation + z.custom(0, z.el.orig[prop]); + } else { + z.o.hide = true; + + // Begin the animation + z.custom(z.el.orig[prop], 0); + } + }; // Each step of an animation z.step = function(firstNum, lastNum){