Why provides the jquery promise a faster chained animation than the common callback chaining -


both animations should have same speed not!

the jquery promise quicker can measure eyes ;-)

why that? technically same , chaining jquery functions.

 $.when( $('#a1').fadeout() )  .done( $('#a2').fadein() );       vs.   $('#a1').fadeout(function () {     $('#a2').fadein(function () {     }); }); 

do instead:

$.when( $('#a1').fadeout() ).done(function() { $('#a2').fadein() }); 

notice added function() {} around fadein(). not having part causes code execute fadein() instead of passing function parameter done() function.

http://jsfiddle.net/mxbta/


Comments