JSFiddle - React, Tailwind, and code Playground

by Evan Sharp

HTML

<button id="left">&lt;&lt;</button><button id="right">&gt;&gt;</button>
<div id="a"></div>

CSS

#a {
 height: 20px;
 width: 20px;
 background-color: green;
 position: absolute;
 left: 40px;   
}

JavaScript

$("#left").click(function(){
    var box = $("#a");
    box.animate({left:"-=50"},2000);
});
$("#right").click(function(){
    var box = $("#a");
    box.animate({left:"+=50"},2000);
});