<body>
<div id='container'>
<div id='cpanel' style="position:fixed;">525</div>
</div>
<div class='modal' style="position:fixed;>323</div>
</body>
I want to prevent any click on container
and its children if modal
is visible.
js
$('#container, #cpanel').click(function(){
if ($('.modal').is(':visible')) {return false;}
});
Click on container
is blocked, but on cpanel
is not !
Any help?
2
Answers
Try stopPropagation method:
https://codepen.io/anon/pen/zjywXV
A possible solution can consider the CSS pointer-event property.
If you are using the jquery ui dialog you can add the code to the events: