Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Thursday February 8 2018 - 06:02:28

V5 Hiding/Showing Menues Manually


Poster: gporterfield
Dated: Tuesday August 19 2003 - 18:55:50 BST

The following code for version 3 was posted elsewhere in this forum (#7095).

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);
}


Will this also work for version 5? Or is there a different way to do this in version 5? I am primarily interested in being able to turn on/off the "alwaysvisible" attribute when showing (popup?) or hiding (popdn?) a sub-menu in a fixed location.

TIA,
George


Poster: Hergio
Dated: Tuesday August 19 2003 - 19:44:43 BST

Nothing has been found yet. But its something I would like to put together, much like Kevin did. If someone beats me to it, more power to them. But I am gonna play around with it in the mean time.


Poster: kevin3442
Dated: Saturday August 23 2003 - 11:28:50 BST

Hi All,

My this seems to have been a busy forum of late! Looks like I've been missing a lot of fun. Haven't had much time these days for menu tinkering. I probably shouldn't admit it, but I'm still using v3 and am just now getting the chance to really play with v5 ( :oops: don't scold me John!). I've just been reading the latest posts to try to learn more about actually using v5... IMHO this forum is still the best learning resource, with so many people helping out, especially guys like John and Dave (thanks guys).

Anyway, I came across this thread and figured that, since v5 still has essentially the same built-in gmobj() and getMenuByName() functions that I co-opted for doing stuff like this in v3, a similar solution might present itself for v5. So I figured this might be a good place to get my v5 "tinkering" feet wet. (I hope you don't mind me jumping in Dave). v5 no longer has an SDiv() function, so the approach is a little different, but only a little, from the v3 function earlier in this thread. Fortunately, the menu object styles in v5 seem to be a lot more accessible (at least to me). Anyway, it's late and I'm rambling... so here it is:

Code: Select all

function mm5_setMenuVisibility(menuName, visState)
{
  menuObj = gmobj("menu" + getMenuByName(menuName));
  if(ns4) {
    menuObj.visibility = visState ? "show" : "hide";
  }
  else {
    menuObj.style.visibility = visState ? "visible" : "hidden";
  }
}

mm5_setMenuVisibility() takes two parameters: menuName is the name of the menu you want to hide or show, passed as a string. visState specifies the state of the menu style's visibility attribute: pass a 1 to show the menu or a 0 to hide it (true or false, respectively, will also work if you prefer). So, to hide a menu named "mainmenu", you'd call:

Code: Select all

mm5_setMenuVisibility('mainmenu', 0)

To show it again, you'd call:

Code: Select all

mm5_setMenuVisibility('mainmenu', 1)

George... I did a quicky test and it worked in IE6, NS7, and Opera 6.05 in Windows. The conditional should, in theory, allow it to work in NS4, but it'd be wise to test first, if you care about NS4, because I didn't (and I don't!).

Hope that helps. Cheers all. Hope to be back soon.

Kevin

Manually Hiding/Showing in V5


Poster: gporterfield
Dated: Monday August 25 2003 - 13:58:06 BST

Kevin:

Have not had a chance to test your suggestion in NS4 yet, but will do so tonight. However, what I REALLY need is to be able to control the ALWAYSVISIBLE attribute through my code. I am trying to keep these menus from disappearing after an item is clicked.

George

NS4 Test


Poster: gporterfield
Dated: Tuesday August 26 2003 - 3:09:45 BST

Quick test results from NS4 look good. Will check in more detail later.

George