Search code examples
jqueryhoverslidedownslideup

jquery to only allow one rollover at a time


I created a .slideDown & .slideUp effect on a div based on mouseover and mouseleave.

The problem is that when I rollover multiple divs to fast then rolloff it seems to keep a memory of how many times I rolled over and will not stop until all of the slideDowns and slideUps are carried out.

Example: http://juliosalvat.com/IconTest/


Solution

  • Yeah, this is A nasty one. Jquery keeps a queue of events, to short cut that queue you can use .stop()

    http://api.jquery.com/stop/

    What you'll probably need is .stop(true, true) which will remove all animation in the queue and just play the last one.