SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist IJoeR's Avatar
    Join Date
    Feb 2003
    Location
    Somewhere in, MD
    Posts
    400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onMouseOut delay code to not close my menus

    Here is the code i am using on my buttons for my menu system.

    Code:
    <a href="1.html" onmouseover="javascript:switchid('menu1'), MM_swapImage('itsON','itsON','../images/b-its-active.gif',1);" onmouseout="javascript:hideallids('menu1','menu2','menu3','menu4','menu5'), MM_swapImgRestore();">Some button would go here</a>
    What i want is to have the menu delay so it doesn't disappear when you mouseout of the button and mouseover the submenu.

    Right now for some reason in Firefox on MAC it just disappears when i mouseout of the button so i think i need to add a very, very short delay.

    Anyone got something i can add to my button onMouseOut to add a less then a second delay?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Code:
    function timeDelay(delay) {
    //parameter: amount of time you want to delay the operation, in milliseconds
     setTimeout ( function ()
     {
     hideallids('menu1','menu2','menu3','menu4','menu5');
     MM_swapImgRestore();
     }, delay);
    }
    Example of use:
    HTML Code:
    <a href="1.html" onmouseover="javascript:switchid('menu1'), MM_swapImage('itsON','itsON','../images/b-its-active.gif',1);" 
    onmouseout="timeDelay(2000);">Some button would go here</a>
    See if that works for you.

  3. #3
    SitePoint Evangelist IJoeR's Avatar
    Join Date
    Feb 2003
    Location
    Somewhere in, MD
    Posts
    400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it appears when i mouseover my button it turns off after the delay even if i have my mouseover the button. Why would act if i don't do onmouseout?

    pretty weird eh?


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
  •