Discovering deferred objects in jQuery

Using callbacks in animations is very easy, but what happens if you wish to use one callbacks after animating several elements? Something like this:
$(".myclass").fadeIn(function(){ //This callback may be executed several times!!! }); |
If you apply a callback directly here, you will execute it as many times as elements are being animated. The solution is something called deferred objects and its used like this:
$.when( $('myClass').fadeIn(); ) .done(function() { //This will be executed only ONCE, after all the animations are over }); |