Results 1 to 2 of 2

Thread: expanded menuitem not collapsing if non-expandable menu clicked

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

    Default expanded menuitem not collapsing if non-expandable menu clicked

    1) Script Title: ddaccordion.js

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...ordionmenu.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>

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

    Default

    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() within these "headers" so roundaboutly achieve what you want:

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

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
  •