Created
June 15, 2011 02:11
-
-
Save lucasmazza/1026351 to your computer and use it in GitHub Desktop.
Animation chain using jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// `then` isn't chainable, so we use `pipe`, which also accepts a 2nd callback for failure filters | |
// http://api.jquery.com/deferred.pipe/ | |
$.Deferred(function(dfr) { | |
dfr | |
.pipe(function() { $('.first').fadeIn() }) | |
.pipe(function() { $('.second').fadeIn() }) | |
.pipe(function() { $('.third').fadeIn() }) | |
}).resolve() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Then function inside the function inside the function inside the... | |
$(".first").fadeIn(function() { | |
$(".second").fadeIn(function() { | |
$(".third").fadeIn() | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IMHO, we should get rid of anon functions and use the jQuery effect functions as top level objects. | |
$.pipe($('.first').fadeIn, $('.second').fadeIn, $('.third').fadeIn); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment