Posts

Showing posts from February, 2013

jQuery Deferred Object method chain or a Syntactic Sugar

The live samples: Chain animation Group async animation Piece of code: function doAnimation () { var duration = 2000; var host = jQuery(".host"); var img = host.children(); jQuery . when ( img .fadeOut(duration)) . then (function () { return host .delay(duration) .slideUp(duration) .delay(duration); }) . then (function () { return host .delay(duration) .slideDown(duration); }) . then (function () { return img .delay(duration) .fadeIn(duration) .delay(duration); }) . then (function () { // it3xl.ru: !The Recursion. doAnimation (); }) ; } I have the next thoughts. Prerequisites 1. The Deprecated and The Removed Let's omit all deprecated and removed functions, parameters, objects etс. See the documentation and be aware of it. Current version of the jQuery is the 1.9.1. 2. The Deferred is everywhere in the j