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: Saturday July 14 2012 - 06:07:29

Problems hiding/displaying the menu


Poster: scoobyd
Dated: Thursday May 6 2004 - 19:06:07 BST

Code:
function mm_showMenu(menuName) {
   if (arguments.length > 1) _m[getMenuByName(menuName)][8] = arguments[1];
   popup(menuName);
}

function mm_hideMenu(menuName) {
   var menuNum = getMenuByName(menuName);
   if (arguments.length > 1) {   
      _m[menuNum][8] = arguments[1];
   }

   menuDisplay(menuNum, 0);
}



As per your post the other day concerning hiding and displaying different menus according to what is selected on a screen, I tried the above two functions without success.

Some background first. We have a design much the same as apple.com, where there are 'tabs' that generate the menu row. But unlike apple, we do not refresh the page each time a tab is clicked on, instead the row is shown right away, so all the menus are actually generated when the page is first loaded, and then only the appropriate menu is displayed according to what tab is set as the default.

We do not want to use the 'menu' for the tabs, instead those are already all setup through the use of li tags, and using netWindows to connect the events ( and of course css ). We instead just want the menu utilized for the menu 'row' underneath the tabs. What I'm having a problem doing is hiding a menu. You stated in that post that the element at position 8 of that array was the alwaysvisible flag, but when I check in the debugger there is an HTMLLIElement in that position, definitely not the alwaysvisible flag. So, how would I go about 'hiding' and 'displaying' a menu based on what is clicked. And I have tried the menuDisplay( <name>, <0,1> ) function and that doesn't seem to work either.


( in the index.html - right now just for simplicity sake )

Code:
<script type="text/javascript">

   with(milonic=new menuname("Main Menu")){
      style=menuStyle;
      top=10;
      left=10;
      alwaysvisible=1;
      screenposition="center";
      orientation="horizontal";
      position="relative";
      aI("text=Home;url=http://www.milonic.com/;status=Back To Home Page;");
      aI("text=Menu Samples;showmenu=MySamples;");
   }

   with(milonic=new menuname("Financials")){
      style=menuStyle;
      top=10;
      left=10;
      alwaysvisible=1;
      orientation="horizontal";
      screenposition="center";
      position="relative";
      aI("text=Home;url=http://www.milonic.com/;status=Back To Home Page;");
      aI("text=Samples2;showmenu=MySamples2;");

   }
   
   drawMenus();
</script>



and in my menu_data.js file

Code:
_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=100            // The time delay before menus open on mouse over
_subOffsetTop=10            // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset


with(menuStyle=new mm_style()){
   onbgcolor="#4F8EB6";
   oncolor="#ffffff";
   offbgcolor="#DCE9F0";
   offcolor="#515151";
   bordercolor="#296488";
   borderstyle="solid";
   borderwidth=1;
   separatorcolor="#2D729D";
   separatorsize="1";
   padding=5;
   fontsize="75%"
   fontstyle="normal";
   fontfamily="Verdana, Tahoma, Arial";
   pagecolor="black";
   pagebgcolor="#82B6D7";
   headercolor="#000000";
   headerbgcolor="#ffffff";
   subimage="images/arrow.gif";
   subimagepadding="2";
   overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
   outfilter="randomdissolve(duration=0.3)";
}

with(mySamples=new menuname("MySamples")){
   style=menuStyle;
   overflow="scroll";
   aI("text=Horizontal Navigational Menu;url=/menusample1.php;");
   aI("text=Vertical Navigational Menu;url=/menusample2.php;");
}

with(mySamples2=new menuname("MySamples2")){
   style=menuStyle;
   overflow="scroll";
   aI("text=Horizontal Navigational Menu;url=/menusample1.php;");

}




So after seeing all that code, to hide the 'MySamples2' menu, should I not just call mm_hideMenu( "MySamples2" );?

Hopefully this makes some sense! And thanks for the help in advance!

Fixed the first problem


Poster: scoobyd
Dated: Thursday May 6 2004 - 19:18:51 BST

I fixed the first problem of the attribute number on the array for the alwaysvisible flag, it is actually at position 7, not position 8. But that still doesn't seem to fix my problem.


Poster: cubefree
Dated: Thursday May 6 2004 - 19:34:39 BST

Yes, I tried the same and other similar code trying to manipulate [7] and got nothing.

doh!


Poster: scoobyd
Dated: Thursday May 6 2004 - 19:44:53 BST

Well I finally got it! I am such a doofus sometimes! It takes stepping away from the code to realize what you are doing. Once the variable is changed to position 7, everything does work as stated....it just helps if you call the proper menu!

So now that's figured out!


Poster: cubefree
Dated: Thursday May 6 2004 - 20:03:26 BST

This appears to finally work! after hours and hours of %!*&!! and javascript:emoticon('8O'). Andy my brain tumor is on your conscience now... just kidding.

Call the function
Code:
onfunction=mm_showMenu('servicesnav', 1);


OR

Code:
onfunction=mm_hideMenu('servicesnav', 0);


Code:
// show a Milonic menu
function mm_showMenu(menuName, vis) {
   if (arguments.length > 1) {
       //alert(arguments.length);
    _m[getMenuByName(menuName)][7] = arguments[1]; }
   popup(menuName);
}

//hide a Milonic menu
function mm_hideMenu(menuName, vis) {
   var menuNum = getMenuByName(menuName);
   if (arguments.length > 1) {   
      _m[menuNum][7] = arguments[1];
   }

   menuDisplay(menuNum, 0);
}


javascript:emoticon(':!:')