I have a picture of my company truck, I am looking for a script that when you access my site, the truck drives across the page. ANy one know where I can find this, or how is it done?
thanks in advance![]()
I have a picture of my company truck, I am looking for a script that when you access my site, the truck drives across the page. ANy one know where I can find this, or how is it done?
thanks in advance![]()
Hope this basic example helps:
Code:<script type="text/javascript"> var i=10; // Initial value of the image function move() { var speed=200, // Speed of the movement. The larger the value, the lower the speed. el=document.getElementById('myimage'), // ID of the image direction='left'; // Direction of image. Values could either be left or right //////////// No need to edit beyond this part el.style.position='relative'; (direction==='left')?el.style.left=i+'px':el.style.right=i+'px'; i+=10; setTimeout('move()',speed); } window.onload=move; </script> <img src="http://rangana.moonylist.com/images/Picture1.jpg" alt="Image1" id="myimage">
Learn how to code at 02geek
The more you learn, the more you'll realize there's much more to learn
Ray.ph!
Why are you increasing the variable by 30? Also, you should either have it stop, dissapear, or rever directions if it reaches the end of the page.
Jeremy | jfein.net
I'm not increasing the variable by 30.
I'm incrementing i variable by 10.
My example is not perfect, it's just basic, so there's flaw on it, and that's where comes the OP's learning curb.
Hope that makes sense to you Nile.
Learn how to code at 02geek
The more you learn, the more you'll realize there's much more to learn
Ray.ph!
Yes, rangana. My mistake, I was playing around with your example, and I made it increase by 30.
Jeremy | jfein.net
thanks guys, as soon as I get my graphic perfect, I'll try the script.![]()
Bookmarks