I have a vertical css menu that I want to convert to a dropdown. I have added some javascript for mouseover to get it to drop down but cannot get it to go away on mouseout.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s a tricky problem to solve, especially when you are fading out instead of immediately hiding. You need to keep track of what the mouse is hovering over, and account for the fact that the mouseenter and mouseleave events don’t fire perfectly at the same time as you move from one tag to another.
Try this out:
http://jsfiddle.net/cgagliardi/NPVVQ/
In the HTML, I removed the onMouseOver code you had on categories and moved it into the JS.
In the CSS, I changed
to
Aside from that, all of the changes are in the javascript. If you want to delay the time it takes for the main menu to fade out, change the 100 value in the setTimeout call.