0

fxqueues Doesn't seem to work with newer versions of jquery.

I am animating many elements and need to pause / play them. Simply stringing callbacks will not give me the control I require (readably at least) as stopping an animation requires a reference to the element being animated and there are many many elements.

I've tried to queue animations to a parent div but that doesn't seem to work. Stuff like:

<div id='parent'>
    <div class='c1'></div>
    <div class='c2'></div>
    <div class='c3'></div>
    <div class='c4'></div>
</div>

$('#parent')
    .queue(function(){$('.c1').animate({...})});
    .queue(function(){$('.c2').animate({...})});
    .queue(function(){$('.c3').animate({...})});
    .queue(function(){$('.c3').animate({...})});

$('#parent').pause();
$('#parent').clearQueueu();

I'm about to play with: stackoverflow answer for something related

is this such a rare need that the jquery team is justified in neglecting this functionality as in requests like this 1 of the many examples? OR is there some other strategy with .promise(), .done(), .defferend(), Callbacks.add()...etc. that I should learn?

Again using callbacks for each animation is cumbersome with many animations and pausing / playing functionality with all those callbacks means my pause function has to have lines for each one of the MANY elements in motion.

$('.c1').pause();
$('.c2').pause();
$('.c3').pause();
$('.c4').pause();
Community
  • 1
  • 1
twinturbotom
  • 1,504
  • 1
  • 21
  • 34

1 Answers1

1

Would the :animated selector help you? You should be able to select all animated elements and stop them.

Matt Burland
  • 44,552
  • 18
  • 99
  • 171
  • that does clean up my pause and start functions! I think have some timing issues to work through without a global queue... Thank you for the direction!. – twinturbotom Nov 16 '12 at 01:26
  • so this isn't working for me because I call functions with timeouts :(. As i mentioned I have some timing issues to work through. I think I have to look into control flow, queueing, instead of nesting callbacks and setTimeouts. Thanks... I'll be back! – twinturbotom Nov 16 '12 at 12:45