i am using jquery accordion as a menu in asp.net Masterpage.
This is jquery
$(document).ready(function() {
$(\".header\").click(function() {
If you add id
attributes to your headers:
<p class="header" id="header-1">Header-1</p>
<div class="menu_body">
<a href="page1.aspx">Link-1</a>
</div>
Then you can pull the id
out in your handler and use jquery.cookie to track the open panel in a cookie:
$(".header").click(function() {
var $this = $(this);
if(!$this.hasClass('display'))
$.cookie('open_panel', this.id);
$this.toggleClass("display");
$this.next("div .menu_body").slideToggle(500);
});
You'd need to play with the storage format for open_panel
a bit if you want to have multiple panels open at one time but a simple CSV list would probably suffice; I'll leave that part as an exercise for the reader. You'd also want to check the cookie when the page loads and open the appropriate panels.
You could also keep track of the cookie's value on the server if you wanted to keep the setting around as part of the user's account preferences.