How do I animate in jQuery without stacking callbacks?
Let's say I have three divs, and I'd like each to animate once the previous one is done. Currently, I write this: $('div1').fadeOut('slow', function() { $('div2').fadeOut('slow', function() { $('div3').fadeOut('slow'); }); }); Which is ugly, but manageable. Now imagine I have 10 different animations that need to happen one after the other on different elements . Suddenly the code gets so clunky that it's extremely hard to manage... Here's pseudocode for what I'm looking to do: $('div1').fadeOut('slow' { delay_next_function_until_done: true } ); $('div2').fadeOut('slow' { delay_next_function