JSFiddle - React, Tailwind, and code Playground
HTML
<div class="outer">
<div class="inner">
<p>Paragraph text.</p>
</div>
</div>
CSS
.outer {
background-color: #000;
position: fixed;
top: 0;
left: 0;
z-index: 9998;
height: 100%;
width: 100%;
opacity: 0.5;
}
.inner {
background-color: blue;
width: 240px;
position: fixed;
z-index: 9999;
left: 50%;
top: 50%;
margin-left: -300px;
margin-top: -150px;
}
JavaScript
$(".outer")
.on("click", function () {
$(this).find(".inner").slideUp();
})
.on("click", ".inner", function (event) {
event.stopPropagation();
});