PDA

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



Zenguy
05-26-2008, 02:52 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 am using the code as an include on a PHP page.
This now causes a problem. When you click a link from
the expanded links the code leaves the accordion open.
Here is my webpage to view what I am talking about.
http://www.zentyx.com/
If you expand the Tutorials 'n stuff then click the MOHAA scripting (videos) you will be directed to that page.
But notice how the links are still expanded. Is it possible to have an automatic close once the link is clicked?

Thank you for your time.

Zenguy
05-27-2008, 12:56 PM
Sorry for the bump, but I have posted a new question.
Thank you for your time and help.

ddadmin
05-27-2008, 05:57 PM
This is due to persistence of the accordion state being turned on. Inside the configuration portion, simply set that to false:


persiststate: false, //persist state of opened contents within browser session?

Zenguy
05-28-2008, 02:32 AM
Thank you.
So I assume that line goes in the ddaccordion.js file?
I did add that code, just below...

contentclassname:{}, //object to store corresponding contentclass name based on headerclass
But it's not working with that attempt.

Can you please let me know if I atleast put it in the correct spot?

Thank you

ddadmin
05-28-2008, 03:51 AM
No, what I posted is part of the configuration code you used to initialize each Accordion content. For example:


<script type="text/javascript">

ddaccordion.init({
headerclass: "expandable", //Shared CSS class name of headers group that are expandable
contentclass: "categoryitems", //Shared CSS class name of contents group
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
animatedefault: false, //Should contents open by default be animated into view?
persiststate: false, //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, isclicked){ //custom code to run whenever a header is opened or closed
//do nothing
}
})

</script>