View Full Version : Glossy Accordion Menu - a couple of issues

07-10-2008, 11:21 AM
1) Script Title: Glossy Accordion Menu

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

3) Describe problem:

There are two:

a: A submenu is open and when I click on another header (which is a link without a submenu), it goes to the appropriate page but the submenu remains open. I would like the first submenu to close, especially since it is not appropriate to the current page.

b: The headers for the submenus should also be links, taking the user to another page. I have links associated with the headers, but at the moment they are ignored when a header is expanded. Is there any way of them to take you to a new page and expand the submenu? I do not want to use iframes.

Thank you.:)

07-11-2008, 01:16 AM
Both a) and b) are expected behavior actually. Regarding:

a) If you click on a link on the page that is simply a link and not part of an Accordion content headers group, there is no way for that group to be "aware" of that action, and close one of its sub menus accordingly. You'll have to manually tell (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm) the script to close all contents within that group when that happens, for example:

<a href="javascript:ddaccordion.collapseall('mygroup')">Arbitirary link</a>

b) This has been asked many times actually. I've never quite understood why though, since the two actions are conflicting of one another, and shouldn't exist together IMO. Anyhow, you can do this either by specifying that the headers expand/contract on "mouseover", in which the headers automatically work as regular links again, or use the "onopenclose" event handler of the script, as talked about in this thread (http://www.dynamicdrive.com/forums/showthread.php?t=34199).

07-17-2008, 11:04 AM
My knowledge of javascript is very limited so forgive me if my ignorance is frightening.

Where does the mygroup come in? Should I include the term mygroup anywhere else, in the original ddaccordion.js for example?

Another thing: if the href in the link is now to act as a javascript command which collapses the submenus, then how is it to act as a link to another page?

Thank you.

07-17-2008, 06:55 PM
Well, menu headers are part of the same "group' if they share the same CSS class name as specified in the script's intialization code for that menu:

headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group

So as mentioned, if you wish an arbitrary link to close all the headers in the above accordion instance, you'd do something like:

<a href="javascript:ddaccordion.collapseall('submenuheader')">Arbitirary link</a>

Another thing: if the href in the link is now to act as a javascript command which collapses the submenus, then how is it to act as a link to another page?

That's exactly my point actually on not understanding why people's interest in having a header act both as a sub menu toggler and actual URL. :) It makes sense if you're using the "mouseover" option so the headers expand the sub menus onmouseover, leaving "onclick" open to navigate to a URL using.