I looked all over stackoverflow and cannot seem to find the answer.
I am trying to make a drop down menu with jquery. With no animation, when you click the button the menu drops down, but the when moving the cursor into the menu the menu disappears.
Any ideas?
> Blockquote
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.myMenu > li').bind('click', openSubMenu);
$('.myMenu > li').bind('mouseout', closeSubMenu);
function openSubMenu() {
$(this).find('ul').css('visibility', 'visible');
};
function closeSubMenu() {
$(this).find('ul').css('visibility', 'hidden');
};
});
</script>
> Blockquote
<body>
<ul class="myMenu">
<li>
<a href="#" ><img src = "settings.png"></a>
<ul>
<li><a href="#">Login</a></li>
<li><a href="#">Edit Register</a></li>
<li><a href="#">Edit Posts</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</li>
</ul>
</body>
</html>
<style>
.myMenu {
margin:0;
padding:0;
}
.myMenu li {
list-style:none;
float:left;
}
.myMenu ul {
background-color: cccccc;
}
.myMenu li a:link, .myMenu li a:visited {
display:block;
text-decoration:none;
padding: 0.5em 2em;
margin:0;
color:#000000;
}
.myMenu li ul {
position:absolute;
visibility:hidden;
margin:0;
padding:0;
}
.myMenu li ul li {
display:inline;
float:none;
}
.myMenu li ul li a{
border-bottom:1px solid #000000;
border-top:1px solid #000000;
border-left:1px solid #000000;
border-right:1px solid #000000;
}
</style>