JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test">d</div>
<button id="classic">classic animation</button>
<button id="var">animation via variable</button>
CSS
div {
position: absolute;
}
JavaScript
$("#classic").click(function() {
$("#test").css('left', 0).animate({ left: 10 }, 1000);
});
$("#var").click(function() {
$({ left : 0 }).animate({ left: 10 }, {
duration: 1000,
step: function(now, fx) {
$("#test").css('left', now);
}
});
});