PDA

View Full Version : Resolved Preventing the header expanding twice



Claes
07-08-2009, 09:29 AM
Sorry for posting before testing thouroughly, I managed to find a solution by changing 3 params:


persiststate: true,
oninit:function(headers, expandedindices){ },
onopenclose:function(header, index, state, isuseractivated){
if (isuseractivated==false) {
ddaccordion.expandone('submenuheader', 3)
}
}


1) Script Title: Glossy Accordion Menu

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

3) Describe problem:
I am developing a site where I use the accordion menu. All contents are stored in xml and by means of xslt I transform it to html and accordion js.
The problem I am facing is that the header pages and submenu pages are also accessible from navigating in images on different pages (not clicking the menu itself). When clicking such links I need to know which header to expand and which submenu item to "highlight". The expanding part is done in xslt which writes the oninit() code, e.g. "ddaccordion.expandone('submenuheader', 3)" for expanding the 4th header.

Now, all this works fine when navigating in images, but... it also means that when clicking a header in the menu, the following happens:
1) The header expands and loads the correct page (revealtype: "clickgo")
2) The oninit function performs a ddaccordion.expandone() which expands the header once again, thus creating an annoying "blink".

Generated code:


ddaccordion.init({
headerclass: "submenuheader",
contentclass: "submenu",
revealtype: "clickgo",
mouseoverdelay: 200,
collapseprev: true,
defaultexpanded: [],
onemustopen: false,
animatedefault: false,
persiststate: false,
toggleclass: ["", "expanded"],
togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"],
animatespeed: "fast",
oninit:function(headers, expandedindices){
ddaccordion.expandone('submenuheader', 3)
},
onopenclose:function(header, index, state, isuseractivated){}
})


Any ideas how to solve this...?

Thanks
/Claes