Sorry, I didn’t read your question carefully to get the wrong answer.
But, according to your question, you want to cover the whole page with divblocking the click event, but you still want to get the click event, then you can actually do this:
1) Remove pointer-events:none;from this divand add cursor:
#big_div {
width: 100%;
height: 100%;
display: block;
cursor: none;
}
2) Add a listener to yours div, as I mentioned, and don't let the click from there:
document.getElementById("big_div").addEventListener("click", function(e) {
e.preventDefault();
if (document.getElementById('div1').style.display == 'block') {
document.getElementById('div1').style.display = 'none';
}
});
source
share