I could have sworn I've seen a plugin that would do that. Anyway, couldn't you do something like this:
var a1 = $('.class1'); if (a1.length > 0) { a1.animate({...}, run_second_animation); } else { run_second_animation(); } function run_second_animation() { // use the same construct for the second and third animations } I haven't tested that but it seems like it would work for you scenario, especially given that you have a limited number of animations in the chain. Of course you could probably generalize it real nicely too if you wanted. If that doesn't work for you, you could check out: http://berniecode.com/writing/animator.html On May 24, 6:47 am, Gordon <[EMAIL PROTECTED]> wrote: > I've already posted on this topic before, but I really am gettign > quite desperate as the project deadline looms and I still don't have a > solution. > > I need several animations to happen, but I need them to happen in > sequence rather than all at once (first animation: hide unselected > items. Second animation: Move visible items to new locations to > occupy space taken by unselected items/make space for currently hidden > selected items. Third animation: Reveal currently hidden selected > items). > > I tried using the callback method, but this has a serious drawback for > my purposes, in that if one of the animations in the chain doesn't > occur (because no items were unselected but some new ones were > selected, for example) then all subsequent animations don't occur > either. If a jQuery selector returns 0 results then applied effects > aren't executed. > > What I need is some code that will ececute my animations one after the > other, but which doesn't depend on all animations in the chain being > triggered for the subsequent animations to play. Is there a plugin > for doing this? Or is it slated as a new feature for jQuery? Or has > anyone else come up with a solution to the problem? > > Sorry to keep asking this but like I said, it's getting pretty urgent.