PDA

View Full Version : expanded menuitem not collapsing if non-expandable menu clicked



hretter
04-13-2009, 06:13 PM
1) Script Title: ddaccordion.js

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm

3) Describe problem:
I have a mixture of collapsible and non-collapsible menuitems on a page. If I click on an expandable menu, it expands with no problem. If I then click on another expandable menu, the previously expanded menu collapses, again no problem. It's when I click on an unexpandable menu, the previously expanded menu does not collapse.
The following is a sample menu. Selecting either Demo menu collapses the other if it's open, but clicking Home does not collapse any open Demo menu.

Is there a workaround for this? Thanks.

-Henry

<code>
<div class="glossymenu">
<a class="menuitem" href="index.html">Home</a>
<a class="menuitem submenuheader" href="" >Expandable Demo</a>
<div class="submenu">
<ul>
<li><a href="menu1.html">Submenu 1</a>
<li><a href="menu1.html">Submenu 2</a>
</ul>
</div>
<a class="menuitem submenuheader" href="" >Expandable Demo 2</a>
<div class="submenu">
<ul>
<li><a href="menu1.html">Submenu 2.1</a>
<li><a href="menu1.html">Submenu 2.2</a>
</ul>
</div>
</div>
</code>

ddadmin
04-16-2009, 06:42 AM
Well, non collapsible headers (ie: Home above) technically are not part of the headers the script observes, hence there's no way for the menu to react based on a click occurring on them. You might try manually calling the function collapseall() (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm) within these "headers" so roundaboutly achieve what you want:


<a class="menuitem" href="index.html" onClick="ddaccordion.collapseone('submenuheader', index)">Home</a>