I am trying to animate a div to move to the right when I click its grandchild. However I am constantly running into a problem with the timing. My doubt is that I am not using the setTimeout
function right. Could someone kindly see if they spot an error. I would prefer if my own function worked rather than using a jquery
function as i have no prior experience in jquery
function sendrequest(element) {
var element=element.parentNode.parentNode;
var i=0;
while(i<150) {
right=i+"%";
myVar=setTimeout(element.style.right=right,3000);
i++;
}
}