JSFiddle - React, Tailwind, and code Playground

HTML

<div id="container">
<div style="position:absolute; left:10px; top:10px; background-color:red; width:150px; height:150px">div 1</div>
<div style="position:absolute; left:80px; top:20px; background-color:magenta; width:150px; height:150px">div 2</div>
<div style="position:absolute; left:120px; top:10px; background-color:yellow; width:150px; height:150px">div 3</div>
<div style="position:absolute; left:110px; top:70px; background-color:green; width:250px; height:200px">div 4</div>
<div style="position:absolute; left:50px; top:100px; background-color:blue; width:200px; height:150px">div 5</div>
</div>

JavaScript

$("#container").on("click", "div", function(e) {
  $("#container div").css("z-index", 0); 
  $(this).css({ "z-index": 10, "opacity": 0.4 })
         .fadeTo(400, 1);
});