Dequeue

3 minutes
Share the link to this page
Copied
  Completed
Execute the next function on the queue for the matched elements.

Transcript

Hello, in this jQuery video I am going to show you the dq method. So the dq method should be used in conjunction with the queue method. And essentially if you have, you know other animations or a thing triggered after you've cued something on an element, then you need to use a dq Otherwise, the rest of the animation for example will work. What I've got is a div which is in shape all the blue box, background blue height and width of 100 pixels, but this dq budget of use a selector to pick that button up and then an event on the next button, click on a normal selectors and click fill please check out those videos in this series. So first of all, we need to get the div so or the element we want to get the one we can just get directly using element name selector like so.

Now what we want to do div dot animate, so let's animate it. What we are going to do, we're going to animate it to a height of 300. We are going to say set it to slow speed, then we'll go to do something similar. Instead of setting the height, we're going to change the width now to 300. Let's still slow speed. And let's just run that see what we get if we run that dq.

So it did it you know, one by one, okay, simple stuff. So if we want to, you know, cue something you can do deep queue. And the code inside of here is totally dependent upon what your requirements are. For me. I'm gonna give CFS back color. Red, Greg Watch what happens.

If I reload it cue changes where it wants all the animation has cut. Okay, what would happen if we basically want to change the size of it or back afterwards, so we will be wrong on? Let's see what? Okay, so it's changed to red. But this hasn't worked. So why hasn't it worked.

So if I were to move that over here instead and run it, as you can see, that you know, works fine. But as soon as you choose one thing, you cannot do anything else in your animation, unless you d queue it. And to do that, so basically in the queue, you do div or the item that you've selected. In this case, I've assigned the result of the selector to the variable data dot P, Q, and this is just a method Is it a nice white woman? Watch what happened. Boom, boom.

Oh, it works now. Okay, so if you're using a queue, you need to make sure you use the dq method that will allow you to run anything else afterwards on the selected element. simple stuff. If you have any questions, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.