serg serg - 1 year ago 92
Javascript Question

jQuery: Can I call delay() between addClass() and such?

Something as simple as:


doesn't seem to work. What would be the easiest alternative?

Answer Source

You can create a new queue item to do your removing of the class:


Or using the dequeue method:


The reason you need to call next or dequeue is to let jQuery know that you are done with this queued item and that it should move on to the next one.