I am using Jquery to shown and hide an overlay on the web page.
In my scenario, I am showing an overlay menu and currently close the overlay when an item within the menu is clicked (click event detected and then overlay closed).
$('#menu a').click(function(){ $('.overlay').hide(); });
Nice and simple!
I now have a requirement that I want to hide the overlay when anywhere on the screen is clicked other than the menu item (for convenience).
Here's an example:
$('.overlay').click(function(){
// pseudo code
if (isDivClicked == false){
$('.overlay').hide();
}
});
Is there a way to see if the clicked area is the overlay but NOT the div shown (with the menu items).
Thanks in advance!