JSFiddle - React, Tailwind, and code Playground
by Clint
HTML
<div style="position:fixed" id="box">
BOX
</div>
CSS
#box {
padding: 1rem;
background-color: PaleTurquoise;
}
JavaScript
const loop = () => {
const el = document.getElementById('box');
if (el.offsetLeft >= 1000) return; // Stop at some point
el.style.left = (el.offsetLeft + 10) + "px"
setTimeout(loop, 1000);
}
loop();