aboutsummaryrefslogtreecommitdiffstats
path: root/src/fx
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2006-12-08 09:26:50 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2006-12-08 09:26:50 +0000
commit12d13d9adaea1139b0928180c17aa83eef5d5c6a (patch)
treed172883745f738246564cc92fc50370b82076226 /src/fx
parentf1c91fd023ad0bbd01a386bca4d8503e0e27df73 (diff)
downloadjquery-12d13d9adaea1139b0928180c17aa83eef5d5c6a.tar.gz
jquery-12d13d9adaea1139b0928180c17aa83eef5d5c6a.zip
finally added the toggle option for animate(). It's not beautiful right now, but it works for the time.
Diffstat (limited to 'src/fx')
-rw-r--r--src/fx/fx.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/fx/fx.js b/src/fx/fx.js
index 7c2218e14..789220f11 100644
--- a/src/fx/fx.js
+++ b/src/fx/fx.js
@@ -484,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){