fadeToggle(). as suggested by Karl Swedberg in his jQcon talk. patched live! omg

This commit is contained in:
Paul Irish 2010-10-17 14:26:32 -04:00
parent 8a5df39045
commit 97dfa0d5a8
3 changed files with 12 additions and 1 deletions

3
src/effects.js vendored
View file

@ -252,7 +252,8 @@ jQuery.each({
slideUp: genFx("hide", 1), slideUp: genFx("hide", 1),
slideToggle: genFx("toggle", 1), slideToggle: genFx("toggle", 1),
fadeIn: { opacity: "show" }, fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" } fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) { }, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) { jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback ); return this.animate( props, speed, easing, callback );

View file

@ -259,6 +259,9 @@ Z</textarea>
<div id="slidetogglein" class='chain test'>slideToggleIn<div>slideToggleIn</div></div> <div id="slidetogglein" class='chain test'>slideToggleIn<div>slideToggleIn</div></div>
<div id="slidetoggleout" class='chain test out'>slideToggleOut<div>slideToggleOut</div></div> <div id="slidetoggleout" class='chain test out'>slideToggleOut<div>slideToggleOut</div></div>
<div id="fadetogglein" class='chain test'>fadeToggleIn<div>fadeToggleIn</div></div>
<div id="fadetoggleout" class='chain test out'>fadeToggleOut<div>fadeToggleOut</div></div>
<div id="fadeto" class='chain test'>fadeTo<div>fadeTo</div></div> <div id="fadeto" class='chain test'>fadeTo<div>fadeTo</div></div>
</div> </div>

View file

@ -729,6 +729,13 @@ test("Chain slideToggle out", function() {
jQuery('#slidetoggleout div').saveState(jQuery.support.shrinkWrapBlocks).slideToggle('fast').slideToggle('fast',jQuery.checkState); 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() { 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); jQuery('#fadeto div').saveState().fadeTo('fast',0.5).fadeTo('fast',1.0,'linear',jQuery.checkState);
}); });