Skip to content

Instantly share code, notes, and snippets.

@craigmdennis
Created October 1, 2013 10:12
Show Gist options
  • Save craigmdennis/6776365 to your computer and use it in GitHub Desktop.
Save craigmdennis/6776365 to your computer and use it in GitHub Desktop.
Instead of nested functions when animating
var p = new $.Deferred().resolve();
$.each([
[$marker, 100],
[$america, 150],
[$england, 80],
[$australia, 300]
], function(_, x) {
p = p.then(function() {
return x[0].animate({
top : x[1]+'px'
}, 500, 'easeOutBounce').promise();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment