JSFiddle - React, Tailwind, and code Playground
HTML
<button id="left">«</button> <button id="right">»</button>
<div class="block"></div>
CSS
div {
position:absolute;
background-color:#abc;
left:50px;
width:90px;
height:90px;
margin:5px;
}
JavaScript
$("#right").click(function() {
$(".block").animate({
"left": "+=50px"
}, "slow", function() {
animationCallback1();
});
});
$("#left").click(function() {
$(".block").animate({
"left": "-=50px"
}, "slow", function() {
animationCallback2();
});
});
function animationCallback1() {
alert($(".block").is(':animated'));
}
function animationCallback2() {
setTimeout(function() { alert($(".block").is(':animated')) }, 0);
}