JSFiddle - React, Tailwind, and code Playground
by icodeforlove
HTML
<div class="target"></div>
<div class="overlay"></div>
CSS
.target, .overlay {
position: absolute;
left: 0px;
top: 0px;
width: 100px;
height: 100px;
}
.target {
background: green;
}
.overlay {
pointer-events: none;
}
JavaScript
document.querySelector('.target').addEventListener('click', function () {
alert('target clicked');
});
document.querySelector('.overlay').addEventListener('click', function () {
alert('overlay clicked');
});