Skip to content Skip to sidebar Skip to footer

Trouble Getting Jquery Accordion To Close All Panels

I'm working off of an accordion script, some pages have sub pages (about, approach, our work) and some do not. If the user is on a page that there is no sub menu, I don't want an

Solution 1:

I think the issue you're running into is that the state is being persisted because of the setting: persiststate: true,.

It looks like what happens is, rather than opening the clicked headerbar (ie. Salons) and closing the other headerbars, it just goes straight to the linked page since there's no submenu. And since you're persisting the state, the open headerbar is staying open on the new page.

So, my suggestion is to use the defaultexpanded option, to open the specific headerbar you want opened on the specific page. You could then turn off persiststate and let the pages themselves handle which headerbar should be expanded. It may be a little more work, but it will give you fine control over which menus are open by default when visiting the pages.

Post a Comment for "Trouble Getting Jquery Accordion To Close All Panels"