JSFiddle - React, Tailwind, and code Playground
HTML
<div id="below">
This is the one below. (Now move the mouse.)
</div>
<div id="hover">
Click me! (But don't move the mouse after you click)
</div>
CSS
#hover:hover,
#below:hover {
background-color: #f00;
}
#below {
padding:10px;
position: absolute;
top:0;
left:0;
}
#hover {
background-color: #ddd;
padding: 10px;
position: absolute;
left: 0;
top:0;
transition: top 1s ease;
z-index: 100;
}
#hover.hidden {
top: 50px;
}
JavaScript
$("#hover").click(function() {
$("#hover").addClass("hidden");
$("#below").trigger("mouseover");
});
$("#below").hover(function() {
$("#below").css("background-color", "#f00");
}, function () {
$("#below").css("background-color", '');
});