I\'m in the process of learning Javascript and I\'m trying to create a simple dropdown menu. An example of my desired functionality can be seen on the google homepage in the top
Here is more or less the logic we use in our web app for drop down menus:
The trick is to use an input
field that has the focus
, and when it looses it an onblur
is triggered and close the menu.
The mouseover
, mouseout
are there to prevent the onblur
to fire when the user click an item in the menu.
To have a toggle effect like an open/close on the link, I guess 2 links that hide each other are needed.