Hiding Menus Manually / Showing Menus Manually

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
User avatar
nbarth
Super Advanced
Super Advanced
Posts: 41
Joined: Tue Jul 29, 2003 11:03 am
Location: Minnesota
Contact:

Hiding Menus Manually / Showing Menus Manually

Post by nbarth »

I have an issue using version 3.5.15. I have a number of menu sets on on page that currently act independantly of eachother. One static menu for the top navigation and various menu sets that are supose to show/hide based on a selection from the top ("Click" and sidebar menu stays until another selection from the top is made). The top navigation is always the same, however when you select an option in the top navigation I would like to be able to hide/show the corresponding menu in the sidebar manually (setting a variable or making some function call) and have it stay visible until another selection is made from the top. I have looked at the code, but it is so obsure that I have a tough time deciphering the meaning of the variables. I have been programming javascript for a number of years so technical answers are ok.

Thanks in advance for any help,
Nicholas :)
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Nicholas,

Here are a couple of functions that might help:

Code: Select all

function mm_showMenu(menuName) // + , alwaysVis)
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    var menuArr = eval("menu" + menuNum);
    menuArr[7] = arguments[1];
  }
  SDiv("menu" + menuNum, 1);
}
mm_showMenu() takes the name of the menu you want to open as it's first parameter (menuName), and the Always Visible state as an optional second parameter (alwaysVis). For example, suppose you want to open a menu named "sidemenu". You would call:

Code: Select all

mm_showMenu('sidemenu', 1);
The 1 in the second parameter sets the menu's Always Visible property, so the menu will not close until you do so programatically, using the mm_hideMenu() function, shown below.

Code: Select all

function mm_hideMenu(menuName) // + , alwaysVis)
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    var menuArr = eval("menu" + menuNum);
    menuArr[7] = arguments[1];
  }
  SDiv("menu" + menuNum, 0);
}
mm_hideMenu() does what it suggests: hides the named menu. If you wanted to close "sidemenu" you would call

Code: Select all

mm_hideMenu('sidemenu', 0)
Note that the 0 to clear the Always Visible property is not really necessary (you can actually programatically hide a menu even if it's Always Visible property is set), but it makes logical sense, especially if you want to open the same menu for some other reason, then have it disappear automatically when the user mouses out of it.

Hope that helps,

Kevin
User avatar
nbarth
Super Advanced
Super Advanced
Posts: 41
Joined: Tue Jul 29, 2003 11:03 am
Location: Minnesota
Contact:

Post by nbarth »

Thanks Kevin, that helped a ton! I really appreciate the answer.

Nicholas
Post Reply