JSFiddle - React, Tailwind, and code Playground
by Ali Khaled
HTML
<div id="container">
<div id="chopper">
<img src="http://www.abramsbooks.com/wesandersoncollection/images/chopper.gif" />
</div>
</div>
CSS
#chopper {
width: 50px;
height: 50px;
position: absolute;
top: 0;
left: 0;
}
#container {
border:1px solid black;
height:400px;
width:600px;
}
JavaScript
var width = $('#container').width();
function loop() {
$('#chopper').css({left:0});
$("#chopper").animate({"left":width}, 5000, "linear", function(){
loop();
});
}
loop();