JSFiddle - React, Tailwind, and code Playground
HTML
<a class="toggler">Click this</a>
<div class="parent active">
<div class="child red"></div>
</div>
<div class="parent">
<div class="child blue"></div>
</div>
CSS
.parent {display:none; cursor:pointer;}
.child {width:100px; height:100px; background-color:red; position:relative; animation: move 200ms cubic-bezier(.91,.8,.54,1.39);}
.active {display:block;}
.child.red {background-color:red;}
.child.blue {background-color:blue;}
@keyframes move {
from {left:0;}
to {left: 180px;}
}
JavaScript
$(".toggler").on("click", function(){
$(".parent").toggleClass("active");
});