JSFiddle - React, Tailwind, and code Playground
HTML
<div class="mydiv div1"></div>
<div class="mydiv div2"></div>
<div class="mydiv div3"></div>
<div class="mydiv div4"></div>
<div class="mydiv div5"></div>
CSS
.mydiv {
width: 80px;
height: 30px;
}
.div1 {
background: red;
left: 10px;
}
.div2 {
background: blue;
left: 70px;
}
.div3 {
background: green;
left: 140px;
}
JavaScript
$(".mydiv").click(function () {
var $t = $(this);
$t.siblings().css("z-index", 1).animate({
"margin-top": 0
}, "fast");
if ($t.css("z-index") == 1)
$t.css("z-index", 2).animate({
"margin-top": -10
});
else
$t.css("z-index", 1).animate({
"margin-top": 0
}, "fast");
});