trying to make an img hit the left side of my screen and return to the right. going right to left is super easy but i cant seem to find the left side of my screen for a reference point. using screen.width is there a way to get the left side of the screen? ive tried (screen.width-screen.width) and just guessing screen.width-1920 this is my code for right to left.
if(parseInt(el.style.left) > (screen.availWidth - 100))el.style.left = 0;
if(parseInt(el.style.top) > (screen.height))el.style.top = 0;
el.style.left = parseInt(el.style.left) + rn1 + 'px';
el.style.top = parseInt(el.style.top) + rn2 + 'px';
Aucun commentaire:
Enregistrer un commentaire