PDA

View Full Version : Glossy Accordion Menu -Just want menu to start as expanded



Memet
12-06-2008, 05:21 PM
1) Script Title:
Glossy Accordion Menu
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm
3) Describe problem:
As the title says the problem
"Just want menu to start as expanded"
I want the submenus start as expanded when I open the page

Snookerman
12-06-2008, 06:19 PM
Find this code in the .html file:

ddaccordion.init({
headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //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: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
And change the collapseprev to false to allow multiple menus open at the same time. Then add numbers to defaultexpanded starting with 0 for every menu you want to start expanded. Here's an example if you want the first three menus to start expanded:

ddaccordion.init({
headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //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: false, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0,1,2], //index of content(s) open by default [index1, index2, etc] [] denotes no content
When counting the menus, count only those that have submenus.

Memet
12-06-2008, 06:35 PM
Thanks but I'm using it on a forum system to expand/collapse the categories like here in the pic.
http://img396.imageshack.us/img396/5060/32039529pi6.png
And I dont know how many categories will my friend does when he decides those categories.I mean how could I expand all of them?

Snookerman
12-06-2008, 07:02 PM
No problem:

defaultexpanded: [all],

Memet
12-06-2008, 07:08 PM
When I write like that it just stops collapsing,it stays there being expanded

Snookerman
12-06-2008, 07:31 PM
Yes, I just noticed, that is because of the script in the .js files which requires the value to be an array. Javascript is not my strong side, maybe ddadmin can chip in. Until then, you could just write as many numbers as you think you need:

defaultexpanded: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
That will work if you have between one and sixteen categories you need to be expanded. That means that if you have more than that, the rest or the menus will not be expanded but since you will have categories for a forum, I'm guessing you won't have more than 15-20. To be safe you could go up to 50 or a hundred.

Memet
12-06-2008, 07:35 PM
Well thanks anyway , I will wait if ddadmin answers,thanks a lot ;)