i have a code which i want to run in loop but its only running one time i tried intervel but its not working
here is the code :
var getposition = 0;
var intervalinfo ;
function setpostion(){
document.getElementById("join").style.position = "absolute";
document.getElementById("join").style.left = "0px";
document.getElementById("join").style.top = "100px"
intervalinfo = setInterval(getanimation ,50);
}
function getanimation() {
getposition += 5;
document.getElementById("join").style.left = getposition + "px";
if (getposition > 500) {
// clearInterval(intervalinfo);
document.getElementById("join").style.left = "0px";
}
}
window.onload = function() {
setTimeout(setpostion , 2000);
}
Any help is really appreciable in advance :-)