title: jQuery accordion: remove active class when clicking active label
body: <p>I've got a simple accordion that allows all to collapse. So clicking on the active panel collapses it. I have <code>before</code> and <code>after</code> pseudo-classes assigned for the arrows, but I can't figure out how to remove the active class from the active label when clicking on it to collapse it. Active class will be removed if clicking on a different label, but not if clicking on the active label to collapse it. </p>
  
  <p>Here's a <a href="http://jsfiddle.net/6yNGa/" rel="nofollow">fiddle</a>.</p>
  
  <p>And here's the script:</p>
  
  <pre><code>$(".accordion &gt; dt").click(function(){
      $('.active').removeClass('active');
  
      $(this).addClass('active');
      if(false == $(this).next().is(':visible')) {
          $('.accordion &gt; dd').slideUp(600);
      }
      $(this).next().slideToggle(600);
  });
  </code></pre>
  
  <p>I've tried a couple of different configurations (e.g., reversing the <code>if(false)</code> statement and removing <code>active</code> class), but everything I've tried has been a shot in the dark. Any help appreciated.</p>