View Full Version : Moving image - help!

03-08-2012, 05:45 PM
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
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.