JSFiddle - React, Tailwind, and code Playground

by mlms13

HTML

<p>Click the animating box:</p>

<div></div>
<div id="mover"></div>
<div></div>

CSS

div {
    background:yellow;
    border:1px solid #AAA;
    width:80px;
    height:80px;
    margin:0 5px;
    float:left;
}
div.colored {
    background:green;
}

JavaScript

$("div").click(function(){
    if ($(this).is(':animated')) {
        $(this).toggleClass('colored');
    }
});

function animateIt() {
  $("#mover").slideToggle("slow", animateIt);
}

animateIt();