PDA

View Full Version : Resolved Accordion Menu collapse all headers



MrSlash
01-11-2011, 04:01 PM
1) Script Title: Urban Gray Accordion Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...menu-urban.htm

3) Describe problem:

I'd like to collapse all the expanded menu by clicking on a determinate element. I noticed there's a function "collapseall" that probably does what I''d like but how can I implement it in my code?

Example:
ELEMENT1
ELEMENT2
sub-element2.1
sub-element2.2
sub-element2.3
ELEMENT3
ELEMENT4
ELEMENT5

By clicking on ELEMENT4 I would like to have

ELEMENT1
ELEMENT2
ELEMENT3
ELEMENT4
ELEMENT5


Can anyone help me please?

ddadmin
01-13-2011, 01:02 AM
Yep, the collapseall (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm) function should work nicely here. Just call:


ddaccordion.collapseall('header_class')

where "header_class" is the shared CSS class name of your headers within the accordion. Here's an example:


<a href="#" onClick="ddaccordion.collapseall('mypets'); return false">Collapse All</a>

MrSlash
01-19-2011, 02:27 PM
Thanks! It worked perfectly!