Results 1 to 7 of 7

Thread: Shaking faster

  1. #1
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Shaking faster

    1) Script Title: Shake Image Script

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamicindex4/shake.htm

    3) Describe problem:
    When using this script with with multiple images without any space in between, the shaking goes faster and faster. Probably the setTimeout is adding up or something??

    Is there a way to "update" this script so that the shaking is going the same speed all the time? The problem is also there on the script-url. Just move your mouse from one pic to another a few times.

    Thanks.
    Sandy

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Hmm... It appears there needs to be a clearTimeout() somewhere in there.
    - Mike

  3. #3
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Mike,

    Thanks.

    The setTimeout is in function rattleimage...

    setTimeout("rattleimage()",50)

    Gr, Sandy

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Make the setTimeout() a variable:

    Code:
    var time = setTimeout("rattleimage()",50)
    and set the image's onmouseout event handler like this:

    Code:
    <img onmouseout="clearTimeout(time)">
    - Mike

  5. #5
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Code:
    var time = setTimeout("rattleimage()",50)
    will probably need to be just
    Code:
    time = setTimeout("rattleimage()",50)

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Meh... Lol
    - Mike

  7. #7
    Join Date
    Sep 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks

    Yes, it works!
    Thank you, thank you!

Bookmarks

Posting Permissions

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