SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question How do I use setTimeout with onmouseout?

    I have an image that when hovered, another image pops up (this popup image has a 'learn more' button on it), but when someone attempts to mouse over the button, the image restores to its original image. I was advised to use 'setTimeout' but do not know how to apply it with the following code:

    Code:
    <area shape="poly" coords="594,37,572,51,545,66,514,78,491,71,471,67,451,76,452,99,457,125,467,147,473,160,463,190,469,219,483,239,503,244,528,250,549,279,573,306,609,298,721,211,751,209,738,162,615,41" href="#" onmouseover="MM_swapImage('eitems','','images/BKSSLIndoorOutdoor_over.jpg',1)" onmouseout="MM_swapImgRestore()" />
    I understand WHY it's going back to its original state (the mouse is hovering outside of the area coordinates), but how can I apply the setTimeout script to DELAY the image from going back to its original state?

  2. #2
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onmouseout="setTimeout('MM_swapImgRestore()', 2000);"

  3. #3
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Replace the onmouseout stuff with this:

    Code javascript:
    setTimeout(MM_swapImgRestore, 1000);
    The number is in milliseconds.

  4. #4
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That worked beautifully! 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
  •