Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Moving image - help!
03-08-2012, 05:45 PM #1
- Join Date
- Mar 2012
- Thanked 0 Times in 0 Posts
Moving image - help!
Hi there folks.
I am a bit stuck with a little code. I am making a online yearbook entry and I wanted an image of myself animate/move from the top left hand to the bottom right of the screen.
I also wanted to allow people reading it the option to change bg colour and text size - but I have managed to do those.
The difficulty I am having is with moving the image, could anybody suggest any simple codes because I am new to this and don't want my head spinning before I go any further!
Any help is greatly appreciated.
03-08-2012, 11:28 PM #2
- Join Date
- Apr 2011
- Thanked 69 Times in 69 Posts
That's reasonably staright forward. Just use css positioning to position the image in the top left hand corner and then use either setTimeout() or setInterval() to gradually move the image by calling a function which increments the image's top and left style values until it gets to its final destination. You adjust the setTimeout/setInterval execution interval, and the top and left style increments accordingly to get a smooth animation/movement for the image.