View Full Version : Expandall/Contractall needed for bulleted accordion list

06-07-2010, 08:34 PM
1) Script Title:
Bullet List Accordion Menu

2) Script URL (on DD):

3) Describe problem:
I've finally set up this wonderful script on a page and styled it to fit our site, and now realize it should have an expand/all contract all option for people who just want to see the entire page contents at once. Is there a way of adding this simply to this menu?

Thank you.

06-08-2010, 11:08 PM
Please see the section "Adding arbitrary links on page that expand/ collapse the contents (http://www.dynamicdrive.com/dynamicindex17/ddaccordion_suppliment.htm)".

06-09-2010, 02:24 PM
I did, and tried that before posting the question here, but it didn't work. I've undone it since, but will re-do and post code here because I cannot see what's wrong.

06-09-2010, 02:43 PM
Here is the html

<a href="#" onClick="ddaccordion.expandall('expandable'); return false">Expand all headers</a>
<div class="arrowlistmenu">
<h3 class="menuheader expandable">Anthropology</h3>
<ul class="categoryitems">
<li><a href="anthropology_ma.html">M.A. Anthropology</a></li>
<li><a href="anthropology_phd.html">Ph.D Anthropology</a></li>
<li><a href="politicaleconomy_p.html">Ph.D. Anthropology with Specialization in Political Economy</a>

And here is the script from the top of the page. Any assistance would be greatly appreciated.

headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: false, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
//do nothing
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing

06-09-2010, 08:36 PM
Just looking at the code you posted nothing looks amiss. Please post a link to the page on your site that contains the problematic script so we can check it out.

06-09-2010, 09:28 PM
Will do. It will have to wait until Friday though as I'm now away from the office until then and I took the page down.

06-11-2010, 02:22 PM

Here is the link. Expand all headers doesn't work.

06-15-2010, 07:08 PM
Can anyone help?

06-16-2010, 04:25 AM
Sorry for the delay. After quite some time debugging this, it seems the issue has to do with one of the other scripts on your page somehow conflicting with the expandall() function. If I disable all scripts on your page except jQuery and Accordion Menu script, the expand all feature works. I'm not sure which script exactly is the culprit yet, though you'll want to find out by systematically enabling the disabled scripts one by one until the expand all function stops working again.

06-16-2010, 02:49 PM
Yes! I believe I've zeroed in which ones are the problem, there is a pair of script links that appear to be redundant (they appear earlier in the page and again further down). Can see no reason for them to be there. I've disabled them (will remove once it's crystal clear they are truly redundant)
Expand all/contract all works like a charm, now.

Thank you!

06-16-2010, 03:54 PM
Well actually it may have been more complicated than some redundant script links, there does appear to be one in particular that is the problem--but regardless, it is the presence of another script on the page that is creating the problem.
Thanks again.