Add Cookie to jQuery Sidr

Add Cookie to jQuery Sidr

am trying to add a cookie to my jQuery call for the plugin called Sidr

I want the slide to stay open when toggled and add a cookie to remember the state.

e.g.

  1. $('#simple-menu').sidr({ side: 'left' // By default });

Any ideas on how to do this please? the following are the open and close calls.

  1. //close
  2. $.sidr('close', 'sidr-main');

  3. // Open
  4. $.sidr('open', 'sidr-main');



I have found an example online and tried to modify this http://jsfiddle.net/7m7uK/ but failing. Ive taken the cookie code from JSFiddle and tried to add in the Sidr plugin call. so confused. Any help would be greatly appreciated.

modified script that doesnt work yet as im still working on it.
  1. $('#simple-menu').sidr({ side: 'left' // By default }); // Open / Close Panel According to Cookie //  if ($.cookie('panel') == 'open'){ $.sidr('open', 'sidr'); } else { $.sidr('close', 'sidr'); } $('#aaa').click(function(){  if ($(this).is(':hidden')) { $.cookie('panel', 'closed'); } else { $.cookie('panel', 'open'); } }); 

Thanks

Nick