91
rated 0 times
[
96]
[
5]
/ answers: 1 / hits: 15731
/ 8 Years ago, sun, july 10, 2016, 12:00:00
I'm trying to close an overlay window by clicking on the outer body only.
The problem is that the overlay get closed even if I click on the overlay panel itself and if I click on any other element i put in it (divs, buttons, icons etc etc...)
I don't know how to target only the body around the overlay and not the overlay window itself.
Can you please help?
Here is both html markup and related JS.
<div id=main>
<div classother-content>
<!-- other content -->
</div>
<!-- The Modal -->
<div id=myModal class=modal>
<!-- Modal content -->
<div class=modal__content>
<!-- some content - divs, buttons etc etc -->
</div>
</div>
</div>
$(document).on('click',#myModal, function(e) {
$('#myModal').fadeOut();
});
More From » jquery