A javascript hack to have Spry CollapsiblePanels remember their state

Adobe Dreamweaver uses the Spry CollapsiblePanel plugin to create boxes that expand and collapse when a heading is clicked.

The following code allows the open/close state of the panels on a page to be remembered when the page is reloaded, or when history is accessed. It can also be used to share the open/close state between many pages containing the same panels.

It uses the sessvars.js framework to access javascript session state. This can be downloaded from the same page where you can find the documentation.

You should include this right at the bottom of the html file containing the panels, like this:

And this should replace the javascript which Dreamweaver added to create the panels.

Leave a comment

Your email address will not be published. Required fields are marked *