View Full Version : Accordion Menu Script

Johnny Cornmuffin
07-28-2008, 04:36 PM
1) Script Title: Accordion Menu Script

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

3) Problem: When I open a sub-menu manually and don't close it afterwards, it remains open when I go to a new page on my site or when I refresh the site. How do I get the menu to reset itself to an entirely closed position when opening a new page on the site or when refreshing the site?

07-28-2008, 09:12 PM
In your HTML page, find the code that should look something like this:

<script type="text/javascript">

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" or "mouseover
collapseprev: true, //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: "normal", //speed of animation: "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

Find the highlighted in the code above.
I think that this should be switched to false.

Johnny Cornmuffin
07-29-2008, 02:28 PM
Thanks. :)