Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    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.

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    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.


  •  

    LinkBacks (?)


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •