PDA

View Full Version : JsDoMenuBar submenu?



pandota
09-23-2004, 11:06 AM
how can i get a submenu into the JsdoMenuBar?
I looked on both DD and the creators site but found nothing except that DD uses a submenu, so i know it is possible just don't know how to do it. do u?

The bar i am refering to is located here:
http://www.dynamicdrive.com/dynamicindex1/jsdomenubar/

thanks in advance for any help or direction.

gigabites
09-23-2004, 06:56 PM
Take a look at the demo page "demo1_quirks.htm"


fixedMenu1 = new jsDOMenu(120, "", "fixed");
with (fixedMenu1) {
addMenuItem(new menuItem("Item 1", "", "blank.htm"));
addMenuItem(new menuItem("Item 2", "", "blank.htm"));
addMenuItem(new menuItem("Item 3", "", "blank.htm"));
addMenuItem(new menuItem("-"));
addMenuItem(new menuItem("Item 4", "", "blank.htm"));
addMenuItem(new menuItem("Item 5", "item5", "blank.htm"));
}It creates fixedMenu1. Look at that last line. It has "item5" variable in it.


fixedMenu1_1 = new jsDOMenu(130, "", "fixed");
with (fixedMenu1_1) {
addMenuItem(new menuItem("Item 1", "", "blank.htm"));
addMenuItem(new menuItem("-"));
addMenuItem(new menuItem("Item 2", "", "blank.htm"));
addMenuItem(new menuItem("-"));
addMenuItem(new menuItem("Item 3", "", "blank.htm"));
addMenuItem(new menuItem("-"));
addMenuItem(new menuItem("Item 4", "", "blank.htm"));
}This code creates the sub menu for fixedMenu1

Scroll down a little bit, You'll find :

fixedMenu1.items.item5.setSubMenu(fixedMenu1_1);This one connects fixedMenu1_1 as a sub menu of fixedMenu1. It automatically connects "Item 5" with the sub menu because it has the "item5" id on it. If You want "Item 2" instead of "Item 5", move the id to "Item 2". You can change "item5" id to, for example "submenu1", but make sure You change "item5" to "submenu1" in that last code


fixedMenu1 = new jsDOMenu(120, "", "fixed");
with (fixedMenu1) {
addMenuItem(new menuItem("Item 1", "", "blank.htm"));
addMenuItem(new menuItem("Item 2", "submenu1", "blank.htm"));
addMenuItem(new menuItem("Item 3", "", "blank.htm"));
addMenuItem(new menuItem("-"));
addMenuItem(new menuItem("Item 4", "", "blank.htm"));
addMenuItem(new menuItem("Item 5", "", "blank.htm"));
}and

fixedMenu1.items.submenu1.setSubMenu(fixedMenu1_1);
Hope that helps :)