View Full Version : Accordion Menu All collapsed by default

10-24-2009, 11:24 AM
Hi everyone. I'm new to JS language and need an easy change for the accordion menu script, which is located here: http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-arrow.htm

I'd like the menu to be collapsed by default. I tried to change some of the coding in the ddaccordion.js file but can't figure it out. Can someone help me with this?



10-24-2009, 05:37 PM
Check the main index for accordion:


There you will see that you may set the defaultexpanded to [] in the onpage initialization to have it start out all closed. No editing of the main script required.

10-24-2009, 09:05 PM
Thank you! Wish everything was this easy.


11-16-2013, 06:54 AM

I am trying to achieve this too but when I set defaultexpanded to [] my menu still opens up expanded...?


11-16-2013, 07:43 AM
Please don't take this "did you plug the computer in?" question the wrong way:
Are you certain that you've updated the page correctly, including uploading it to the right location, and that you have cleared your cache?

If that doesn't work, then please post a link to your page so we can look at it to figure out what is wrong. On the (possibly incorrect) assumption that your problem really is the same one that romano had earlier, this should be the fix as well. It's possible you didn't apply the changes correctly, or there might be a different underlying problem. Or, perhaps the solution only works for a certain subset of cases, a detail that was irrelevant for romano because those other cases didn't apply.

Also (although this will probably be evident from your code), did you modify the script in any additional ways? That could explain this, not to say there is no alternative solution.

11-16-2013, 07:45 AM
Make sure persiststate is set to false as well:

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

If you want more help, please start a new thread.