JSFiddle - React, Tailwind, and code Playground
by zono
HTML
<div id="itemHolder">
</div>
CSS
html, body {
width: 100%;
height: 100%;
}
#itemHolder {
width: 90%;
height: 90%;
margin: 0px auto;
}
JavaScript
setTimeout(function (){
var randomFromInterval = function (from,to)
{
return Math.floor(Math.random()*(to-from+1)+from);
}
var holder = document.getElementById("itemHolder");
var holderCoord = holder.getBoundingClientRect();
var image = document.createElement("img");
image.style.position = "absolute";
image.setAttribute("src", "https://sites.google.com/site/jerkonanairplane/babaMarta.gif");
image.setAttribute("class", "march");
holder.appendChild(image);
image.style.left = randomFromInterval(holderCoord.left, holderCoord.right) + "px";
image.style.top = randomFromInterval(holderCoord.top, holderCoord.bottom) + "px";
setTimeout(arguments.callee, 1000);
}, 1000);