Results 1 to 3 of 3

Thread: Collapsing an accordion menu on the next page with one click

  1. #1
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Collapsing an accordion menu on the next page with one click

    Script: Accordion Menu script
    http://www.dynamicdrive.com/dynamici...enu-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.


    Code:
    <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>
    Last edited by ddadmin; 10-21-2009 at 08:03 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    The correct syntax for specifying a remote link that expands a particular header on the target page is:

    Code:
    <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.

    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:

    Code:
    <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.
    DD Admin

  3. #3
    Join Date
    Oct 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your help!!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •