diff options
author | John Resig <jeresig@gmail.com> | 2006-08-24 21:30:21 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2006-08-24 21:30:21 +0000 |
commit | 8a1adfcd2a0ea8fbb72ac53537cbfe6ebeba0cdf (patch) | |
tree | 21e7ee704461d15b36a1cf63847d281cd7066d26 | |
parent | ccf9d4406296fed48aae0989f2303287f133ed9e (diff) | |
download | jquery-8a1adfcd2a0ea8fbb72ac53537cbfe6ebeba0cdf.tar.gz jquery-8a1adfcd2a0ea8fbb72ac53537cbfe6ebeba0cdf.zip |
Added in some more bug fixes - and added the slideToggle method.
-rw-r--r-- | src/fx/fx.js | 7 | ||||
-rw-r--r-- | src/jquery/jquery.js | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/fx/fx.js b/src/fx/fx.js index 2a0c95117..3e8885dd4 100644 --- a/src/fx/fx.js +++ b/src/fx/fx.js @@ -141,6 +141,13 @@ jQuery.fn.extend({ slideUp: function(speed,callback){ return this.animate({height: "hide"}, speed, callback); }, + + slideToggle: function(speed,callback){ + return this.each(function(){ + var state = $(this).is(":hidden") ? "show" : "hide"; + $(this).animate({height: state}, speed, callback); + }); + }, /** * Fade in all matched elements by adjusting their opacity. diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index e3929f0de..a35823842 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -937,7 +937,7 @@ jQuery.extend({ oHeight = e.offsetHeight; oWidth = e.offsetWidth; } else - jQuery.swap( e, { visibility: "hidden", position: "absolute", display: "" }, + jQuery.swap( e, { visibility: "hidden", position: "absolute", display: "block" }, function(){ oHeight = e.clientHeight; oWidth = e.clientWidth; @@ -1405,7 +1405,7 @@ jQuery.extend({ return jQuery.extend( elems, { last: elems.n == elems.length - 1, - cur: n == "even" && elems.n % 2 == 0 || n == "odd" && elems.n % 2 || elems[pos] == a, + cur: pos == "even" && elems.n % 2 == 0 || pos == "odd" && elems.n % 2 || elems[pos] == elem, prev: elems[elems.n - 1], next: elems[elems.n + 1] }); @@ -1426,7 +1426,7 @@ jQuery.extend({ // Move b over to the new array (this helps to avoid // StaticNodeList instances) for ( var k = 0; k < first.length; k++ ) - result[k] = second[k]; + result[k] = first[k]; // Now check for duplicates between a and b and only // add the unique items |