Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-08-2012, 04:45 PM   PM User | #1
jamesy23
New to the CF scene

 
Join Date: Mar 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jamesy23 is an unknown quantity at this point
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.
jamesy23 is offline   Reply With Quote
Old 03-08-2012, 10:28 PM   PM User | #2
webdev1958
Banned

 
Join Date: Apr 2011
Posts: 656
Thanks: 14
Thanked 69 Times in 69 Posts
webdev1958 can only hope to improve
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.
webdev1958 is offline   Reply With Quote
Reply

Bookmarks

Tags
images, javascript, moving

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:01 PM.


Advertisement
Log in to turn off these ads.