JSFiddle - React, Tailwind, and code Playground
by joycse06
HTML
<div class="body">
<div class="a"></div>
<div class="b">
<div class="element first">First</div>
<div class="element second">Second</div>
</div>
</div>
CSS
.body {
position relative;
}
.a {
position: absolute;
left: 20px;
top: 20px;
width: 300px;
height: 600px;
background: rgba(0,0,0,0.5);
z-index: 2;
pointer-events: none;
}
.b {
position: absolute;
left: 40px;
top: 40px;
width: 260px;
height: 300px;
background: blue;
z-index: 1;
}
.b .element {
position: absolute;
width: 50px;
height: 50px;
background: red;
}
.b .element.first {
top: 50px;
left: 50px;
}
.b .element.second {
bottom: 50px;
right: 50px;
}
}
JavaScript
$(function(){
$('.element.first').on('click',function(){
alert('first clicked');//this one needs to be triggered
});
$('.element.second').on('click',function(){
alert('second clicked');
});
});