I got a small script which toggles my nav. But I’m using the nav in more pages. I want jQuery to remember the toggle(show/hide) state so I can use it when navigating.
$(document).ready(function(){
$('ul.second').show();
$('ul.third').hide();
$('ul.first').show();
$('ul.first li.first a').click(function(){
//$('ul.second').slideToggle("");
$('ul.third').slideToggle("");
});
});
You could use either use cookie management or localStorage to store this info across your session. LocalStorage only works with html5 though.
Here’s a good article on a plugin that features both, so you don’t need to detect yourself if the browser is capable of localStorage or not:
http://upstatement.com/blog/2012/01/jquery-local-storage-done-right-and-easy/