I’m working off some code for a drop-down menu I found here on stack overflow: http://jsfiddle.net/jhoffm34/VbtuC/
I have a jquery drop-down menu that expands on click. I am trying to use document.onmousedown to get the menu to close when I click on “Categories” for a second time, but it is just reopening the menu right away. Does anyone know how to fix this?
Working demos
http://jsfiddle.net/RguMu/show
http://jsfiddle.net/RguMu/
http://jsfiddle.net/UK9Qt/ – only when category is clicked show and hide
So on second click, your menu will be closed now:
use
is(':visible')Another suggestion, you don’t need so many properties. Just do
showandhide, rest you know your requirement better.jQuery code
Full code