I make a simple menu in the list, where inside each element there is a second menu.
ul.first li and ul.second li
The menu will move to the right because it is a menu on the left side of the website.
I wrote this in jQuery:
var secs1 = $('ul.first > li');
secs1.hover(
function () {
$(this).find('ul.second').animate({ width: 'toggle' }, 500);
},
function () {
$(this).find('ul.second').animate({ width: 'toggle' }, 250);
}
);
It works fine, but there is a problem inside!
If I press the mouse button and exit one element, it opens and closes many times when I did this.
This is the first thing I want to fix!
Second:
if the mouse enters and takes out the mouse before the switch is completed, I would like it to not finish switching everything except to stop it and start switching back to the beginning.
I hope everything will be clear enough for your help!
Thank!
EDIT:
Look at fiddle
source
share