View Full Version : Accordion Menu script (v1.3)

06-02-2008, 11:42 PM
1) Script Title: Accordion Menu script (v1.3)

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

3) Describe problem: I have everything up and running. What doesn't seem to be happening is when I click on one that has a submenu, I can't get that button to go to the correct website. It only drops down the list of the sub catagory. Now If I right click on the button with the drop down menu and have it open in a different page it will send me to the correct link. How do I get it to open the page when clicking on it the first time?

Thank you very much.


06-03-2008, 02:06 AM
Hmm I'm not sure I understand. Do you have a link to the problem page?

06-03-2008, 07:16 PM
sure here it is.


so click on containers and the submenu will show but it won't send you to the containers.html page. If you right click on the container menu and open in new window it will take you to the site.


06-04-2008, 12:57 AM
Are you asking why clicking on the "Container" main header merely expands the sub menu, instead of also going to a URL? That's normal, since headers themselves aren't meant to act as URLs, but a way to expand/ hide sub menus. This is how all the demos on the DD script page behave as well.

Not sure why you would want the headers hyperlinked, as this means as soon as the user clicks on one, before the sub menu even has a chance to expand, the user is whisked to another page. To enable it however, find the below lines in the .js file:

ddaccordion.collapseit($(this), $subcontent, config, true) //Last Boolean value sets 'isclicked' parameter
return false

and remove the line in red.

06-06-2008, 05:00 PM

That does the trick. Now there seems to be a problem with the menu. If you click the menu going down from containers to offices then to finance. Everything works like it should. Now if you work backwards bottom to top and click on those, it doesn't open up like it should. Is there a way to fix this?

Thanks again for everything.


06-08-2008, 08:48 PM
Hmm I believe I see the problem, as you're referring to the persistence feature no longer working as it should. When you enable a header to not only expand/collapse sub content, but navigate to a URL, the very likely scenario of the corresponding sub content not having fully expanded before the user is whisked away to the new page occurs. This means to the persistence feature, that sub content wasn't expanded the last chance it had a chance to look at it, resulting in that content not appearing expanded on the new page.

The best solution I can think of is just to upgrade your script to v1.4 (http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm), which supports expanding of sub contents onMouseover. That way, clicking on the headers now only does one thing- navigate to a URL, instead of also carrying the burden of expanding a sub content.

06-09-2008, 04:12 PM
Thank you very much!