JSFiddle - React, Tailwind, and code Playground
HTML
<div id='boxed'>
</div>
CSS
#boxed {
border: 1px solid green ;
background-color:green;
width:100px;
height:50px;
}
JavaScript
function placeDiv(x_pos) {
var d = document.getElementById('boxed');
d.style.position = "absolute";
d.style.left = x_pos+'px';
setTimeout(function(){ placeDiv2(10); }, 1000);
}
function placeDiv2(y_pos) {
var d = document.getElementById('boxed');
//d.style.position = "absolute";
d.style.top = y_pos+'px';
setTimeout(function(){ placeDiv(15); }, 1000);
}
placeDiv(10);