PDA

View Full Version : Accordian: Want a main menu item with no children, collapse other submenu on click



bainsbury
07-22-2010, 05:18 PM
1) Script Title:
Accordian: Want a main menu item with no children, collapse other submenu on click
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

3) Describe problem:
I am trying accordian and I think it is great. I do have one problem. I have a menu where some of the main menu items do not have children. I Know I can add them as static items but .... if one menu item is selected and its submenu is displayed, when a user clicks on a different menu item (that has no children), I want the on-display submenu to collapse and focus to be placed on the newly clicked childless menu item. Make sense? Phew.

You can see a simple example here http://www.ainsbury.com/accordiantest/

Any and all advice is appreciated

bainsbury
07-22-2010, 08:14 PM
I solved it myself....if you have the same problem, add a little onclick to the non-child-top menu a. Here is an example:


<a href="#" onclick="ddaccordion.collapseall('submenuheader')">Dashboard</a>

ddadmin
07-22-2010, 08:35 PM
I gather you mean, for example, when "menu3" is expanded, you wish clicking on "menu 4" to collapse the former's sub contents? If so, one way to do it is just by calling one of the expand/collapse methods (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm) of the script inside the later, ie:


<h3 class="titlenav"><a href="#" class="menuitem" onClick="ddaccordion.collapseall('submenuheader')">Menu 4 - No Children</a></h3>

bainsbury
07-22-2010, 08:53 PM
Yes you understood my problem and confirm the fix (see self reply). Many thanks....bob