PDA

View Full Version : Problem collapsing all Sub-Accordions when another Accordion item is selected



due23
04-22-2010, 10:01 AM
1) Script Title: DD Accordion

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

3) Describe problem: I have four accordions (headerclass: "research_accordion") on a page, and within one accordion I have two Sub-Accordions (headerclass: "subexpandable"). See http://www.due23.org.uk/Protected/Earth-Sciences/ResSubThemes.asp and expand 'Physics of Earth Processes' to see these Sub-Accordions. If one of the two Sub-Accordions is open, and the user clicks on a non-Sub-Accordion item (for instance 'How continents move') I would like the Sub-Accordion to close and for the selected Item to be displayed. I have added an 'onClick' item to the <a href. tag as shown in your excellent help area, and the Sub-Accordion closes beautifully. Unfortunately the selected URL is not activated. Am I doing something wrong? The picture is slightly complicated because each link in the Accordion menu system actually calls the same page with a single '?ID=xxx' parameter to tell the page to get the data from a selected entry in a database table.

due23
05-04-2010, 05:45 PM
What I had done was to add the onClick event as ' onClick="ddaccordion.collapseall('subexpandable'); return false" '. This of course catches the onClick event and does the collapseall, but then returns false, which stops the Hyperlink itself from being enacted. Changed the code to be ' onClick="ddaccordion.collapseall('subexpandable'); return true" ' and it all works beautifully.