View Full Version : Bullet Accordion Menu No Submenu and Current Page highlight

12-13-2008, 07:26 PM
1) Script Title: Bullet List Accordion Menu with nested levels

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

3) Describe problem:
My site link http://www.llewoh.com/Busing/Test

Hello there. In customizing slightly this menu system I have run into a couple items that I have not been able to find the solution through hours of searching all the Dynamic Forums.

1. On my site you will see I have a "Profile" link that has no submenu system. How can I get this link to collapse the "Project" header menu?

2. When you first arrive to the index.html page I would like the entire menu system to be collapsed. I have tried everything including "defaultexpanded: [] w/ or without a value. What do I need to do in order to have this system fully closed at index and contact? I

3. How can I get the current "Project" page submenu item to be highligted i.e. Projects-->Civic-->WCC Classroom (each of these should be solid black once that page is active).

I greatly appreciate your assistance with this.

12-13-2008, 07:40 PM
#2 Make sure these two settings look like this:

defaultexpanded: [], //nothing inside the bracket will make all menus collapsed as default.

persiststate: false, //this will start from default every time you refresh the page

12-14-2008, 12:35 AM
Snookerman thank you for that answer on technical #1 & #2. If you go back to the site now you will see that when you arrive the menu is closed on both Profile and Contact.

Now Profile and Contact pages both use the same template which allowed me to change the defaultexpanded and persiststate as you noted below.And get the desired effect.

The Project pages use a separate template with the menu system set there too so i have control over the accordion system on there too.

How can I get when a user does hit Project from the Profile or Contact Page and the menu opens up to not retain the previous state? But just show the the indvidual submenus (i.e. civic, corporate, historic, etc). I have played with the defaultexpanded and persiststate but no luck...there are most likely some limits...(if you click through I think you will understand.

Any luck on previous post question 3 with highlighted state on current active page?

12-14-2008, 08:09 AM
#1 Find this code for the 2nd level headers:

ddaccordion.init({ //2nd level headers initialization
headerclass: "subexpandable", //Shared CSS class name of sub headers group that are expandable
contentclass: "subcategoryitems", //Shared CSS class name of sub 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
onemustopen: false, //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: false, //persist state of opened contents within browser session?
Make sure persiststate is false and defaultexpanded is [].

#2 It seems that this works for the second level, Civic stays highlighted when clicked. Maybe you could do the same for the others? If you can't find out how, I'll try to help you later. Maybe ddadmin knows how to do this?

12-14-2008, 03:07 PM
Snookerman the only problem with Make sure persiststate is false and defaultexpanded is []. at the second level is that when you have been browsing the Projects section as you will from update that this happens:

1. go to site. Hit Projects--> Civic-->WCC first project
2. go to Contact.
3. Now go back to Projects-->Residential-->first project

See how the menu retains the previous project state in item 1 above?

So the question is how to clear that cookie!

As per what I did for Civic and doing the same for the lower levels, I tried that too but I do not believe there is a class that allows the same functionality! I am hoping DDADMIN can take a peak.

Thank you so much.

12-14-2008, 03:28 PM
It doesn't do it for me, it works fine now, they are always closed, I suggest you clear your browser cache. And also, make sure persiststate is false on all pages (on this one (http://www.llewoh.com/Busing/Test/html/civic/wcc_facilities.html) for example they are false on both levels.

I do not believe there is a class that allows the same functionality
You can just add a class. If there is already one, you can add one more, just separate them with spaces: class="value1 value2 value3".

12-14-2008, 04:08 PM
The quirk when you do this:

1. go to site. Hit Projects--> Civic-->WCC first project
2. go to Contact.
3. Now go back to Projects-->Residential-->first project

if you notice it will bring up the first project under residential but the menu will revert back to Civic or previous/last Project category visited just on the initial.

12-14-2008, 04:27 PM
You have not made the changes on all pages. Here is an example.

http://www.llewoh.com/Busing/Test/html/civic/wcc_facilities.html (http://www.llewoh.com/Busing/Test/html/civic/wcc_facilities.html)

Change presiststate to false on all your pages.

12-14-2008, 04:41 PM
Snookerman I know that on my PROJECTS TEMPLATE I haven't turned them all to false because when I am in the projects section viewing projects I want the user to see the submenu nested levels of the project i.e.

PROJECTS-->Civic-->all project under heading (these must always be open under that project section when in projects section so a user can see all of the projects under it.)

The only quirk is just when you first go back to PROJECTS from the PROFILE or CONTACT pages and choose a different project category other than the last one, it will go to that new project but the menu will revert just on the init to the last looked a project. I am trying to figure out:

1. Projects-->Healthcare--Lowenthal Infusion Center
2. LEAVE Projects go to PROFILE PAGE
3. GO BACK TO Projects-->Residential-->Sutton Manor
4. You will note that it went to Sutton Manor BUT the menu itself reverted back to Healthcare!

BUT NOW if you were to surf through the Projects Section everything would function properly.

How can I get it (menu) to forget the last project visited so that when I leave the project section and go to the PROFILE OR CONTACT sections and return to the Projects Section the above example don't happen in the inital revisit to the Projects section?

12-14-2008, 05:02 PM
Ok I understand what you want now, but there is a better approach to this which I think will not cause you any problems.

Start by setting persiststate to false on all pages (hehe echo, echo..). Then if you want for example the first wcc project to be marked when you are on that page, just set it to open by default. Do this for all the pages where you want the user to see the submenus.

12-14-2008, 05:07 PM
Now I get to sound really ignorant. How to I set it to Open by default? see update to site with all false (2nd init)!

12-14-2008, 05:48 PM
You change defaultexpanded: []

E.g. defaultexpanded: [0] to get the first one expand by default. At least I think you start counting at 0, just test it and you'll find out.

12-23-2008, 09:00 PM
how can I get the main headers, sub header and then current nested level to all be black or some common color showing a user which item is current?