JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container left-active">
<div class="child"></div>
</div>
CSS
.container{
width: 500px;
height: 200px;
background:red;
}
.child{
width: 100px;
height: 100px;
background: blue;
}
@keyframes blink{
0% { opacity: 0; }
100% { opacity: 1; }
}
.left-active .child{
float:left;
animation: blink 1s normal;
}
.right-active .child{
float:right;
animation: blink 1s normal;
}
JavaScript
$('.container').on('click',function(){
$(this).toggleClass('left-active right-active');
})