Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Animation chain using jQuery
// `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()
// Then function inside the function inside the function inside the...
$(".first").fadeIn(function() {
$(".second").fadeIn(function() {
$(".third").fadeIn()
})
})
// 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