JSFiddle - React, Tailwind, and code Playground
HTML
<div id="a1"></div>
<div id="a2"></div>
CSS
#a1 {
position: absolute;
top: 0; left: 0;
width: 100px; height: 100px;
background: #000;
}
#a2 {
position: absolute;
top: 150px; left: 0;
width: 100px; height: 100px;
background: #f00;
}
JavaScript
var isAnimate = false;
$("#a1").on("click", function(){
if(!isAnimate) playMyAnimation();
});
function playMyAnimation(){
isAnimate = true;
$("#a2").animate({left: 150},1000,function(){
$("#a2").css("left", 0);
isAnimate = false;
});
}