Gordon wrote:
In reflection, I think what I need is a queue into which classes of
animations can be inserted. All the animation events in a class get
executed together, but each class in the queue is executed one after
the other. Maybe something like this:
animQueue.addClass ('hideClass');
animQueue.addAnim ('hideClass', $('.toHide').fadeOut ('slow'));
[ ... ]
animQueue.addClass ('showClass');
animQueue.addAnim ('showClass', $('.toShow').fadeIn ('slow'));
animQueue.execute ();
I understand what you mean, but the syntax is slightly wrong, I believe.
You are not adding a function to your hypothetical animQueue; you are
adding the results of processing that function. I think you need
somthing more like:
animQueue.addClass ('hideClass');
animQueue.addAnim ('hideClass', function() {
$('.toHide').fadeOut ('slow')
});
But once you see this, you can probably skip the whole
animQueue.addClass bit also, since you can simply group your animations
inside the new functions. My ideal format would be simpler, but I don't
know if there is any way it could be made to work inside JQuery, since I
still haven't really looked into the internal of animations:
$.queue.add(function(){$("#myDiv").fadeIn();})
.add(function(){$("#myDiv").highlight();});
I think Brandon Aaron's implementation [1] was also mentioned on the
thread. That one looks a little easier to understand. You might see if
that one would work for you.
Good luck,
-- Scott
[1] http://brandonaaron.net/jquery/plugins/fxqueue/