JSFiddle - React, Tailwind, and code Playground

HTML

<div class="start"></div><div class="middle"></div>

CSS

.start {
 z-index : 0;
  position:absolute;
   top:50px;
   left:50px;
  width:200px;
   height:200px; 
    background:blue;
}
.end {
 z-index : 10;   
  position:absolute;
   top:50px;
   left:50px;
  width:300px;
   height:300px;
    background:blue;
}
.middle {
 z-index : 5;   
  position:absolute;
   top:30px;
   left:30px;
  width:200px;
   height:200px;
    background:red;
}

JavaScript

$(document).ready(function() {
   $('.start').switchClass('start', 'end', 2000);
});