Hey All,
Currently my code displays all available top menus and the sub menu will be displayed by clicking on one of the items in the main menu. How can I make the sub menu expanded with main menu automatically when the web page is load?
Thanks in advance!
Expand sub menu automatically
Re: Expand sub menu automatically
Hi,
If you grab a copy of this module: http://milonic.com/openmenusbyurl.js and then place a reference to it after your menu_data.js file it should start to open sub menus on page load.
Here is the syntax:
<script type="text/javascript" src="openmenusbyurl.js"></script>
HTH,
Andy
If you grab a copy of this module: http://milonic.com/openmenusbyurl.js and then place a reference to it after your menu_data.js file it should start to open sub menus on page load.
Here is the syntax:
<script type="text/javascript" src="openmenusbyurl.js"></script>
HTH,
Andy
Re: Expand sub menu automatically
Andy,
Thanks for your help!
This is my first time touch Milonic. I am trying to modify the existing code from previous developer to make the sub menu expanded with top menu on the page load. We have left vertical menu bar and the items in the menu (both top and sub) are generated dynamically so we don’t have menu_data.js page. We include milonic_src.js file in aspx page. Here is the HTML code generated from aspx file.
Top menu:
<script language=javascript>
topmenu=new copyOf(leftmenu); topmenu.itemwidth='255'; topmenu.onclass='ResourcesSection'; topmenu.offclass='ResourcesSection';topmenu.clickclass='ResourcesSection';with(milonic=new menuname('TopmenuMainMenu_9246')){style=topmenu;alwaysvisible='1';position='relative';top='0';left='0';
aI('text=Home;showmenu=d6f70716-1229-47c6-96f8-e199e3c381f2;type=tree;image=');
aI('text=Product;showmenu=bce850b5-6938-41b5-a8cb-f206f9b74a06;type=tree;image=');
aI('text=Services ;showmenu=5eac00d8-d9ce-480e-8cca-94f6a626c084;type=tree;image=');
aI('text=Forms;showmenu=e078ebee-ecc8-438a-ae72-49348f08935d;type=tree;image=');
aI('text=Policies;showmenu=6433acfd-f670-40fb-81cc-a9b290d919b4;type=tree;image=');
}drawMenus();
</script>
One of Sub Menus:
<script language=javascript>submenu=new copyOf(leftchildmenu1);
submenu.itemwidth='255'; submenu.onbgcolor='#FFFFFF';submenu.offbgcolor='#FFFFFF';submenu.oncolor='#0066CC';submenu.offcolor='#0066CC';submenu.fontsize=11;submenu.fontfamily='verdana,arial,helvetica,sans-serif';
submenu.fontweight='bold';submenu.image=" img/greenbullet.gif";
submenu.imageheight=8;submenu.offclass='';submenu.onclass='';submenu.clickbgcolor='#FFFFFF';submenu.clickcolor='#0066CC';
with(milonic=new menuname('0f844725-8838-48cc-9d57-7cffa8992331'))
{style=submenu;aI('text=Home;clickfunction=resourceOpen("home.html","600","800");');
aI('text=About us;clickfunction=resourceOpen("aboutus.html","600","800");');
aI('text=Letter;clickfunction=resourceOpen("letter.htm","600","800");');
}</script>
I copied _ocURL function from http://milonic.com/openmenusbyurl.js to milonic_src.js file and added submenu.forceChildSubOpen=true into sub menu style setting, but it doesn’t work.
Could you please tell me how can use the openmenusbyurl.js file to make it work in my case?
Thanks again for your help!
Thanks for your help!
This is my first time touch Milonic. I am trying to modify the existing code from previous developer to make the sub menu expanded with top menu on the page load. We have left vertical menu bar and the items in the menu (both top and sub) are generated dynamically so we don’t have menu_data.js page. We include milonic_src.js file in aspx page. Here is the HTML code generated from aspx file.
Top menu:
<script language=javascript>
topmenu=new copyOf(leftmenu); topmenu.itemwidth='255'; topmenu.onclass='ResourcesSection'; topmenu.offclass='ResourcesSection';topmenu.clickclass='ResourcesSection';with(milonic=new menuname('TopmenuMainMenu_9246')){style=topmenu;alwaysvisible='1';position='relative';top='0';left='0';
aI('text=Home;showmenu=d6f70716-1229-47c6-96f8-e199e3c381f2;type=tree;image=');
aI('text=Product;showmenu=bce850b5-6938-41b5-a8cb-f206f9b74a06;type=tree;image=');
aI('text=Services ;showmenu=5eac00d8-d9ce-480e-8cca-94f6a626c084;type=tree;image=');
aI('text=Forms;showmenu=e078ebee-ecc8-438a-ae72-49348f08935d;type=tree;image=');
aI('text=Policies;showmenu=6433acfd-f670-40fb-81cc-a9b290d919b4;type=tree;image=');
}drawMenus();
</script>
One of Sub Menus:
<script language=javascript>submenu=new copyOf(leftchildmenu1);
submenu.itemwidth='255'; submenu.onbgcolor='#FFFFFF';submenu.offbgcolor='#FFFFFF';submenu.oncolor='#0066CC';submenu.offcolor='#0066CC';submenu.fontsize=11;submenu.fontfamily='verdana,arial,helvetica,sans-serif';
submenu.fontweight='bold';submenu.image=" img/greenbullet.gif";
submenu.imageheight=8;submenu.offclass='';submenu.onclass='';submenu.clickbgcolor='#FFFFFF';submenu.clickcolor='#0066CC';
with(milonic=new menuname('0f844725-8838-48cc-9d57-7cffa8992331'))
{style=submenu;aI('text=Home;clickfunction=resourceOpen("home.html","600","800");');
aI('text=About us;clickfunction=resourceOpen("aboutus.html","600","800");');
aI('text=Letter;clickfunction=resourceOpen("letter.htm","600","800");');
}</script>
I copied _ocURL function from http://milonic.com/openmenusbyurl.js to milonic_src.js file and added submenu.forceChildSubOpen=true into sub menu style setting, but it doesn’t work.
Could you please tell me how can use the openmenusbyurl.js file to make it work in my case?
Thanks again for your help!
Re: Expand sub menu automatically
Hi,
The collapse menu doesn't use openmenusbyurl.js to open them on the matching page. I can't tell from your menu data information just what a page name would be that you wanted to have the corresponding submenu open, but let's say you have an item that when you click it opens a submenu called AdultEducation, and that you have a correpsonding page adult_education.htm Then on that page you would code at the bottom of the page, the last thing before the closing body tag
Hope this helps.
Ruth
The collapse menu doesn't use openmenusbyurl.js to open them on the matching page. I can't tell from your menu data information just what a page name would be that you wanted to have the corresponding submenu open, but let's say you have an item that when you click it opens a submenu called AdultEducation, and that you have a correpsonding page adult_education.htm Then on that page you would code at the bottom of the page, the last thing before the closing body tag
Code: Select all
<script type="text/javascript">
drawMenus();
openBranchByName("AdultEducation");
</script>
</body>
Ruth