...

View Full Version : jQuery: Queue across multiple elements



Keleth
10-24-2010, 08:38 AM
So I've tried googling this in a few different ways, but have only found one solution so far.

I'm just curious if there is a known method/extension for jQuery for queuing up animations across multiple elements? I THINK I've gotten a bit of understanding for the queue function (though not sure why you'd use it over chaining, specially with delay in there), but I haven't quite figured out how to queue animations across multiple elements without calling the animation for the next element in the fallback for the previous one.

To clarify a bit, if I have 3 divs, IDs of div1, div2, div3, if I wanted to make sure they were all hidden (say visa fadeOut), then fade one in based on other things, is there any way to do it without juggling callbacks? In this case, such as:



$('#link').click(function() {
$('div2').fadeOut('slow', function() {
$('div3').fadeOut('slow', function() {
$('div1').fadeIn('slow');
});
});
});


On top of that, is there any way to get two animations on different elements to trigger at the same time? So far, if I go on something like



$('#link').click(function() {
$('div2').fadeOut('slow');
$('div3').fadeOut('slow', function() {
$('div1').fadeIn('slow');
});
});


I get a visible enough delay between div2,div3.

Keleth
10-24-2010, 06:36 PM
Oh, fail... as for the second issue (concurrent animations), it helps when I have the various speeds set the same. I am no longer getting notable differences in animation triggers (at least none someone not looking for it would find).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum