PDA

View Full Version : Help needed on Accordion menu



tejas_k
03-18-2009, 10:39 AM
1) Script Title: Bullet List Accordion Menu

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

3) Describe problem: hello everyone,
i have been using DD scripts from some time, but i am new on this forum.

i am using this this accordion menu on a website. i read the forum for the help on this menu, but to no avail.

The menu works perfectly with the features given on the above page. but in addition to expanding the submenu when one clicks on the header, i also need to open another page. Header itself is also a link.

Now there is a function called onopenclose(),
but it is called only when a header collapses or expands.
but in my case, if the header is open, it is required to remains open. even on clicking on it. i have set onemustopen=true
so this function is not triggered when that header is clicked.

my code is like this

<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
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [1], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
onemustopen: true, //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: "slow", //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
if(index ==0 && document.location != "Payments.html" && isuseractivated){
document.location = "Payments.html";
}
if(index ==1 && document.location != "BackOfficeMgmt.html" && isuseractivated){
document.location = "BackOfficeMgmt.html";
}
//do nothing
}
})
</script>


i really need this badly. Can somebody suggest a solution for this?
i would really appreciate your help. thanks

ddadmin
03-18-2009, 09:19 PM
There are quite a few threads on getting the header to still act as a link when it's used to toggle its sub contents onClick. One such solution by John can be found here (http://www.dynamicdrive.com/forums/showpost.php?p=184355&postcount=9). Just do a search for "accordion menu header click" for example for other examples.

tejas_k
03-19-2009, 09:33 AM
:) wow, the script on the link u gave works wonderfully for me.

thank you so much admin and to all people who create these wonderful scripts.