PDA

View Full Version : Jquery Queue



Deadweight
11-01-2015, 11:36 AM
So I am wondering if it is possible to add animations to a queue, then check if that queue is finished or exists then preform add another animation queue.

If that doesn't make sense please check (http://thebcelements.com/BnS/) on the top left or right (computer only). It's works but glitches because I need to check to see if their are still elements in the queue. Thanks.

jscheuer1
11-17-2015, 01:49 AM
Oh man!! You are pretty much on your own here I think. You might be able to get a straight answer somewhere. If so, ignore what I'm about to tell you.

First - It often does NOT help to parse out (with stops or alerts or whatever) what jQuery is 'telling' you. With lots of things, that can be useful. But with the more 'esoteric' things like jQuery events in an ongoing queue of animations, it's better not to do anything other than watch what happens manually. By that, I mean - run the code, see what happens. If you don't like it, tweak the code - run it again to see if it's now doing what you want.

Now, as to your question. I would say no in a specific sense. But yes in a general way. jQuery isn't quite that robust yet as far as I know. At the same time, the default condition of one animation following another on the same element is to add to the queue. You can also set a callback to any animation. If that's the last one in the current series (queue) that you've setup, it will execute once the others and that one have completed. It will not be a matter of detection though. Just faith that it will execute as you've set it to. Alternatively, if that's just not going to work for some reason, you can setup a generic poll at the same time you set in notion the first event in the queue. It can detect a condition (which presumably indicates the completion of said queue) and then set off another chain of code/events. You can combine the two approaches. Have all events execute the same callback that will call the next bit of code only if a certain condition or conglomeration of conditions obtain. I've done that, works well. In fact, it's the essence of determining when to proceed if and only after all images in a set of images have loaded for example.