JSFiddle - React, Tailwind, and code Playground
HTML
<div id="red"></div><div id="blue"></div>
<button id="btnChange">Change!</button>
CSS
#red{
position: absolute;
width: 178px;
height: 124px;
background-color: red;
overflow: hidden;
}
#blue{
position: absolute;
width: 178px;
height: 124px;
background-color: blue;
overflow: hidden;
display: none;
}
#btnChange{
position: absolute;
top: 150px;
}
JavaScript
$(document).ready(function (){
$('#btnChange').click(function () {
$('#red').hide();
$('#blue').show().delay(1500).hide();
$('#red').show();
});
});