Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Menu DHTML script problems - timer, setTimeout, openMenu(id)

I am having problems with DHTML for my menu system.
The problem is:

  1. Go to http://www.solarinception.com.au
  2. Hover your mouse over menu items on left (Home Owners and Products)
  3. Quickly hover over 'Products' THEN continue down to 'Home Owners'.
  4. Note that one of the menu systems stays open.

You can view the script that makes this happen at:

  http://www.solarinception.com.au/includes/javascript/menu.js
  * View Page Source - to see what methods are called on the menu.

I am think this may has something to do with using a commonly declared timer. The timer is reset in the openMenu(id) call and that stops the other menu closing. The problem is I cannot find a solution.

ALL OTHER ASPECTS OF THE MENU WORK FINE!
0
smacca
Asked:
smacca
1 Solution
 
basicinstinctCommented:
replace your existing menu.js with this code:

ΓΏ

var timeout = 500; //in milliseconds.

 

//open menu

function openMenu(id)

{

    //cancel close timers.

    cancelCloseMenuTimer(id);

   

    //close old layer

    minimise(id);

   

    //get new layer and show it.    

    maximise(id);    

}



//close menu

function closeMenu(id)

{

   minimise(id);

}


var timers=new Object();

//close timer

function closeMenuTimer(id)

{  


    timers[id] = window.setTimeout(function(){closeMenu(id)}, timeout);

}



//cancel close timer

function cancelCloseMenuTimer(id)

{

    if (timers[id])

    {

        window.clearTimeout(timers[id]);

        timers[id] = 0;

    }

}
0
 
smaccaAuthor Commented:
Thanks BasicInstinct!

You fixed the problem (I will award points for regardless), however, a new problem has been introduced:

  http://www.solarinception.com.au

The menu does not STAY OPEN when you mouseover a submenu item.
Could you help here at all???

Cheers.
Steve
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now