JSFiddle - React, Tailwind, and code Playground
HTML
<button>CLICK ME</button>
<div id="red"></div>
CSS
div {
position: absolute;
background: red;
width: 100px;
height: 100px;
position: absolute;
left: 50px;
top: 150px;
opacity: 0;
}
JavaScript
$("button").click(function () {
$(this).next("div").stop(true, true).animate({
"opacity": 1,
"top": "36px"
}, 600, function () {
setTimeout(function () {
$(this).fadeOut("slow", function () {
$(this).css({
"top": 0,
"display": "block",
"opacity": 0
});
});
}.bind(this), 2000);
});
});