PDA

View Full Version : Collapsing an accordion menu on the next page with one click



handemmet
10-21-2009, 10:18 AM
Script: Accordion Menu script
http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm

Hi
I have the example script below on a few pages. My problem is when I click the "Home Page" from the "News" section, the "News" submenu is still expanded on the "Home Page". I have a javascript in there but its not working.

Can anybody help me please?? Thanks in advance.



<a class="menuitem" href="index.html?ddaccordion.collapseall('menuitem')">Home Page</a>
<a class="menuitem submenuheader" href="">News</a>
<div class="submenu">
<ul>
<li><a href="index.html">News Story 01</a></li>
<li><a href="index.html">News Story 02</a></li>
<li><a href="index.html">News Story 03</a></li>
<li><a href="index.html">News Story 04</a></li>
<li><a href="index.html">News Story 05</a></li>
</ul>
</div>

ddadmin
10-21-2009, 08:18 PM
The correct syntax for specifying a remote link that expands a particular header on the target page is:


<a href="target.htm?headerclass=index1,index2,etc">Target Page</a>

where "headerclass" is the shared CSS class name of the headers group in question, and index1,index2 etc the index of the header(s) to expand relative to its peers. Separate each index with a comma (unless there's only 1 index). More info here (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm).

In this case, since what you want is to have all headers on the target page collapsed (or none expanded). you'd do something like:


<a class="menuitem" href="index.html?headerclass=1000">Home Page</a>
<a class="menuitem submenuheader" href="">News</a>
<div class="submenu">
<ul>
<li><a href="index.html">News Story 01</a></li>
<li><a href="index.html">News Story 02</a></li>
<li><a href="index.html">News Story 03</a></li>
<li><a href="index.html">News Story 04</a></li>
<li><a href="index.html">News Story 05</a></li>
</ul>
</div>

You need to change "headerclass" to the shared CSS class name of your headers group. Note the value 1000- this technically means "expand the 1000th" menu header, which most likely doesn't exist, causing all headers to be contracted by default.

handemmet
10-23-2009, 01:47 PM
Thank you for your help!!