Jump to content
Killersites Community
Sign in to follow this  
dianikol85

A jquery question.

Recommended Posts

Hi to all. A quick question about jquery. I noticed that with the animation effect many devs uses this statement : {queue:false} for example: $('#something').animate({something},{queue:false}); Is that something important??? I never had issues not using it. What's the big deal?

 

 

Thank you

Edited by dianikol85

Share this post


Link to post
Share on other sites

From: http://api.jquery.com/animate/

 

"queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately."

 

For example, say you are building out a dropdown menu, where hovering over one of the main menu items will cause a dropdown menu to slide in. It is possible that by hovering over the nav item, moving your mouse quickly off and then back on the item several times would cause an animation queue -- basically, the animation would slide in, out in again -- as many times as you moved the mouse over it. Setting queue to false -- as far as I understand it based on the documentation -- would not allow a queue of animations to build up, but any previous animations would be canceled and the latest one started.

Share this post


Link to post
Share on other sites
but any previous animations would be canceled and the latest one started.

 

Think it automatically skips the animation, and puts the element into the state it's supposed to be in, instead of cancelling the animation halfway. But yea, what Ben said is pretty much the case for animation queue. It's quite standard these days, as it's not very practical for the menu to be animating itself even after the mouse has stopped moving.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×