From 97dfa0d5a85a32fe56aba837bbf2bc889b092d2b Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Sun, 17 Oct 2010 14:26:32 -0400 Subject: [PATCH] fadeToggle(). as suggested by Karl Swedberg in his jQcon talk. patched live! omg --- src/effects.js | 3 ++- test/index.html | 3 +++ test/unit/effects.js | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/effects.js b/src/effects.js index 7d2cd8f93..d7896c0e0 100644 --- a/src/effects.js +++ b/src/effects.js @@ -252,7 +252,8 @@ jQuery.each({ slideUp: genFx("hide", 1), slideToggle: genFx("toggle", 1), fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" } + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); diff --git a/test/index.html b/test/index.html index 03e1d9758..e66872725 100644 --- a/test/index.html +++ b/test/index.html @@ -259,6 +259,9 @@ Z
slideToggleIn
slideToggleIn
slideToggleOut
slideToggleOut
+ +
fadeToggleIn
fadeToggleIn
+
fadeToggleOut
fadeToggleOut
fadeTo
fadeTo
diff --git a/test/unit/effects.js b/test/unit/effects.js index 6baa0f62d..952afc5b1 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -729,6 +729,13 @@ test("Chain slideToggle out", function() { jQuery('#slidetoggleout div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState); }); +test("Chain fadeToggle in", function() { + jQuery('#fadetogglein div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState); +}); +test("Chain fadeToggle out", function() { + jQuery('#fadetoggleout div').saveState().fadeToggle('fast').fadeToggle('fast',jQuery.checkState); +}); + test("Chain fadeTo 0.5 1.0 with easing and callback)", function() { jQuery('#fadeto div').saveState().fadeTo('fast',0.5).fadeTo('fast',1.0,'linear',jQuery.checkState); }); -- 2.39.5