Building on the Quick Start example, you can use jquery.cookie.js to save a cookie containing an array of all open panes, and then use the cookie to set the state of each pane upon reloading the page.
Note: Cookies require a server in order to function, so if you try this on your local machine, you must create a site in your favorite web server, for example, IIS, to host your HTML page.
Reference |
Copy Code |
---|---|
<script src="jquery.cookie.js" type="text/javascript"></script> |
Pane State Script |
Copy Code |
---|---|
<script type="text/javascript"> $(document).ready(function () { $("#accordion").wijaccordion({ header: "h2", requireOpenedPane: false, selectedIndexChanged: function (e, args) { var activeHeaders = $($.find("#accordion .wijmo-wijaccordion-header.ui-state-active")); var indices = ""; activeHeaders.each(function (i, o) { indices += $(o).index(".wijmo-wijaccordion-header") + ";"; }); $.cookie("the_cookie", indices); }, selectedIndex: -1 }); var indices = $.cookie("the_cookie"), i, k; if (indices) { indices = indices.split(";"); for (i = 0; i < indices.length; i++) { if (indices) { k = parseInt(indices[i]); if (isFinite(k)) { $("#accordion").wijaccordion("activate", k); } } } } }); </script> |