• 0

[jQuery] Drop menu - Dancing Problem!


Question

[solved]

Hey,

I have a problem with the below code. I'm pretty new to jquery so it could be obviously missing something! There is no real issue with what I've done, except if you go crazy with the mouse over the menu, it just keeps playing for that ammount of rollovers.

The jquery is:

$("ul#menu > li > a").find("+ ul").hide();

$('ul#menu > li.toplevel').hover(
	 function(){
		  $('ul', this).slideDown("fast")
	 },
	 function(){ 
		  $('ul', this).slideUp("fast")
	 });

I've tried adding the .stop() to just infront of .slideDown etc, but when you go crazy with the mouse, it eventually just hides the entire menu and you cant get it back.

You can see the working menu here

Any ideas on how to fix that?

edit - didn't know where to put this in web design or programming :blink: .. saw a post from like 2008 on jquery here so i just followed the general trend :p

Edited by Callum1001
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Guess...

You are adding your animations to a queue?

The queue is getting longer and longer if you dance your mouse around?

How about checking the length of the queue - if over x then purge and so on?

Link to comment
Share on other sites

  • 0
Guess...

You are adding your animations to a queue?

The queue is getting longer and longer if you dance your mouse around?

How about checking the length of the queue - if over x then purge and so on?

Spot on! I was using .stop(), which was not reseting any style / clearing the que properly. So a simple:

.stop(true, true) did the trick!

All solved :D

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.