try this: $.fn.animateByOrder = function(params, duration, easing, callback){ var i = -1; var arr = this; if($.isFunction(easing)) { callback = easing; easing = null; } (function(){ if(arr[++i]) $(arr[i]).animate(params, duration, easing, arguments.callee) else if(callback) callback(); })(); } $('div.c1, div.c2, div.c3, div.c4').animateByOrder({width:400, height:300}, 'slow', function(){alert('wow!')} );
2008/1/17, Alexandre Plennevaux <[EMAIL PROTECTED]>: > > hi friends, > > i'm storing the steps of a series of animations in an array, that have to > occur one after the others, according to their index order in the array. > > Example: animArray['section', 'item','object1','object2' ]; > > i would like to run a function that loops through the array, and for each > element in the array, perform the animation, then when the animation is > finished, move on to the next element, do its related animation, etc... > until the array is finished. > > > Now, how do i make the animation queue one after the others? > > > Thanks for any feedback/hint, > > Alexandre > > > -- Максим Игоревич Гришаев, AstroStar.ru