As you can see on http://jsfiddle.net/FrelCee/5zcv3/4/ , i want to animate those 3 divs when the container is hovered.
Problem is this ugly queue that appears when you fast hover more than once. I also tried using .stop() function, but then the delay() isn't working.
Here is an example with stop() function and delay() problem : http://jsfiddle.net/FrelCee/FHC99/22/
Does anyone know any better way to this?
Thanks in advance!
You just need to supply at least the first parameter to
.stop(true, true)
to clear the current queue and you can decide if you also want to supply the second parameter to jump to the end of the animation when the next one starts (that's up to you as it gives a slightly different effect). You also need to place the.stop()
calls before the.delay()
so you aren't clearing the.delay()
. See the jQuery doc for.stop()
to understand the two parameters for.stop()
. When I do that here: http://jsfiddle.net/jfriend00/pYgQr/, it seems to handle fast hover in/out just fine.Also, I don't know why you're doing this at the beginning:
You can either do this:
or this:
In addition, there is no reason to do:
These are ids which must be unique in the page so it's better to use:
This will be faster in jQuery because it will be able to just use
document.getElementById('first')
internally.try this http://jsfiddle.net/5zcv3/5/
you don't have to use both
delay
andanimate
, just giveanimate
different speed; the effect is similarbased on my experience,
stop
is a must