Normal hide/show toggling was broken, this fixes it (#1219).
authorJohn Resig <jeresig@gmail.com>
Thu, 21 Jun 2007 02:52:53 +0000 (02:52 +0000)
committerJohn Resig <jeresig@gmail.com>
Thu, 21 Jun 2007 02:52:53 +0000 (02:52 +0000)
src/fx/fx.js

index 51e8157..f53b2b2 100644 (file)
@@ -110,9 +110,13 @@ jQuery.fn.extend({
        toggle: function( fn, fn2 ){
                return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
                        this._toggle( fn, fn2 ) :
        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" ]();
+                               });
        },
        
        /**
        },
        
        /**