multiple "collapsable <div>'s" in cookie
- if($.cookie("panelState") == undefined) {
- $.cookie("panelState", "collapsed");
- }
- var state = $.cookie("panelState");
- if(state == "collapsed") {
- $(".toggle_container").hide();
- }
-
- $("h2.trigger").click(function(){
- if($.cookie("panelState") == "expanded") {
- $.cookie("panelState", "collapsed");
- } else {
- $.cookie("panelState", "expanded");
- }
- $(this).toggleClass("active").next().slideToggle("slow");
- return false; //Prevent the browser jump to the link anchor
- });
- });
Hello,
I use jquery for hiding/collapsing a <div>-tag. Now I want to save the state of the panel in a cookie. (so the state is still the same after reloading the page) (cookie-plugin)
My problem is, that I have more than one "collapsable <div>-tags" on the same page. How can I modify my code, so that it works for each of my "collabsable boxes"? (the state of each one has to be stored in a cookie separately!)
Thanks!!
Léo