if I understand that the element is โnot higher than the href elementโ, do you want the menu to remain visible when the div # menudiv is turned off, but still mussed over # menu_opener ??
if that happens, I would wrap it all in an unqiue div and target. and use mouseleave for the mouse.
http://api.jquery.com/mouseleave/
so your HTML will look like this:
<div id="menu_container"> <div> <a href="#" id="menu_opener">Menu</a> </div> <div id="menudiv" style="position: fixed; background-color: white; display: none;"> <a href="#" id="A1">Page 1</a><br /> <a href="#" id="A2">Page 2</a><br /> <a href="#" id="A3">Page 3</a><br /> </div> </div>
and your script will look something like this:
$("#menu_opener").click(function () { if ($("#menudiv").is(":hidden")) { $("#menudiv").slideDown("slow"); } else { $("#menudiv").hide(); } }); $("#menu_container").mouseleave(function(){ $('#menudiv').hide(); });
Marc smith
source share