]> source.dussan.org Git - jquery.git/commitdiff
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 51e81571819e7cd36c5dfcb475fd104001866de6..f53b2b29e5ed243c53f64af41c8b5e97c419316c 100644 (file)
@@ -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" ]();
+                               });
        },
        
        /**