Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts

    jQuery: Queue across multiple elements

    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:

    Code:
    $('#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

    Code:
    $('#link').click(function() {
    	$('div2').fadeOut('slow');
    	$('div3').fadeOut('slow', function() {
    		$('div1').fadeIn('slow');
    	});
    });
    I get a visible enough delay between div2,div3.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •