jQuery Toggle Cookie Support
- by hell0w0rld
I'm trying to implement the jQuery Cookie plugin into my slide toggle script, but so far haven't been successful. Here's my code (without any cookie implementation):
jQuery:
$(document).ready(function() {
$('a.toggle').click(function() {
var id = $(this).attr('name');
$('#module' + id).slideToggle('fast');
$('a.toggle[name='+id+']').toggle();
return false;
});
});
HTML:
<a class="toggle" name="1" href="#">- Hide</a>
<a class="toggle hidden" name="1" href="#">+ Show</a>
<div id="module1"><p>Hello World</p></div>
Anyone know if it's easy enough to implement the jQuery Cookie plugin into my existing code so it remembers the open/closed state?
Thank you.