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:19
Multiple Menus
Poster: derekwatts
Dated: Friday July 16 2004 - 13:07:19 BST
I have a menu on each of my pages which works fine.
I now want to have a new additional menu on one of the pages which will be always on whenever that page is viewed.
How do I do that?
Poster: Maz
Dated: Friday July 16 2004 - 16:56:50 BST
Duplicate a menu giving it a new menu name and style if necessary.
Then match the page with an if and else{ statement if necessary.
Around this new menu, or if you wanted it around menu items, place this:
if (location.pathname == "/"){
.......
.......
......
}
else{
......
......
}
This example will feed the if statement only to the index page.
If you don't have an else then leave it off.
Realize that this is being wrapped around existing {...}
So if it ends with a }
It will look like this
}
}
maz
Poster: Ruth
Dated: Friday July 16 2004 - 17:17:19 BST
Do you want to have an additional as in a different menu in addition to the one that is on there? So you would have two different menus on the page in two different places? If that is what you want, make a new menu_data.js file with all this menu's information in it, name it differently, for example if the menu is going to be on page3.htm you might name it page3_data.js. Then in your calls put in a call for that file also.
Code:
<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="page3_data.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="page3_data.js" type=text/javascript></SCRIPT>
Ruth
Poster: kevin3442
Dated: Friday July 16 2004 - 19:44:27 BST
Just wanted to add that with Ruth's suggestion (loading another _data.js file), the new menu and submenus in page3_data.js can still use the styles from your main menu_data.js. There's no need to define the styles again if you want to use the same styles for all of your menus.
Cheers,
Kevin
Poster: Ruth
Dated: Saturday July 17 2004 - 3:48:17 BST
Another little thing I forgot to mention. If you make a new data file, make sure you don't name the menus by the same names as in the original data file. They have to be different names so nothing gets confused. I.E. if you had a submenu called links in the first file and also in the second file, which one should the menu program open. I'm not sure how it would decide but it would only open one, I think. Probably the first one it 'reads'.
Ruth