remember toggled class state

remember toggled class state

Hi there, I'm new to the forums and pretty new to jquery, so I'm hoping someone can help.

I have a pretty simple pane slider deal that works great as is, but I'd like to extend it a bit so that it remembers the state it's in rather than simple toggling. The reason for this is because as soon as I add and click on a secondary toggle inside the pane, the main toggle gains the active class when the pane is actually closed.

So I use the primary toggle to open the pane, and inside that pane there is another toggle offering the option to close the pane, but using that causes the primary toggle to add the "active" class to the main toggle when the pane is actually closed.

How can I avoid this? Thanks in advance!


  1. $(document).ready(function(){
        $(".btn-slide").click(function(){
          $("#panel").slideToggle("slow");
          $(this).toggleClass("active");
           return false;
        });
    });






  2. <a href="#" class="btn-slide">Close</a>