View Full Version : Persist & Cookies Problem with "Contractable Headers" Script

09-09-2004, 04:38 PM
I am using the contractable headers script, found here:

It is used as a side navigation menu. It has been modified by adding table rows under the headers. The enablepersist, or cookies, are turned "on". The collapse previous is also set to "yes."

I would show it to you, but it is on a compay intranet. So, I will tell you the situation:

When you click on the first headerA and it expands displaying the five rows containing links, or sub-items. Normally, with the cookies on, you can repeatedly click on all five sub-items and the menu stays "open" or expanded the whole time. And same with headerB: it stays open while you explore all its sub-items.

What I'm having trouble with is switching from header A to header B. The user opens up headerA and will be exploring the sub-items under headerA, and then decides to click on headerB. Thus, headerA closes, and headerB opens. Perfect! Exactly what is supposed to happen.

At this point, the user can see all the items under headerB, but after he clicks on the first link, for some strange reason the menu closes or contracts. (Because it is returning to it's previous state of all the headers being closed.) Now he is feeling a little perturbed when he wants to continue browsing the sub-items under headerB because he has to open headerB again to see them. This time he relaxes, since he has clicked an item under headerB already, it stays open while clicking any of the other links.

Basically, after expanding a heading, it unexpectedly closes the first time you click on a sub-item, but stays open during any successive clicks.

An even worser problem is if the user then goes back and opens headerA, and clicks on an item, not only does headerA close unexpectedly, headerB opens up! (Again, returning to the previous state.)

I know this has to do with the cookies and enablepersits, but cannot figure it out.

Anyone have a suggestion?

Thanks in advance.

09-11-2004, 07:44 AM
Does it have different behavior in some browsers over others. I have found that the tree menu here does not work in Opera enough to be able to use it.

Contractible headers also can get confused by frames pages or ones with lots of iframes. IE handles it differently from Netscape and if you have anything wrong in your code, Netscape isn't very forgiving.

There is also a nested menu worth trying at http://www.javascriptkit.com/. Swich menus are basically contractible headers, by experimenting with several you can find the one which the code works best in your situation.

The way a menu behaves also is influenced by the users by how they have their accept cookies configured and if they decide to clear history. Some things are out of your control if the user doesn't understand about cookies.

09-13-2004, 06:39 PM
Does the problem occur for you on our demo page as well? I'm still a little confused on just what the problem is, though if there's a bug in the script, I'd like to address it.

10-06-2004, 03:34 AM
i have it working on ie, ns, opera and firefox and yes there are mild differences but it is more than worth using