jQuery, make dropdown menu hide when click elsewhere
I'm using jQuery to make a simple drop down menu:
<script>
$("#optionsLink").click(function(){
$("#optionsMenu").slideToggle();
});
</script>
It works fine but I would like the menu to disappear when the user clicks
elsewhere on the screen. A bit like your standard windows drop down menu.
Clicking on "File" in my browser will display the drop down menu but
clicking somewhere else, anywhere on a page for example, will hide the
menu.
How would I go about implementing something like this?
No comments:
Post a Comment