title: Jquery Accordion Expand All Collapse All
body: <p>I was looking for a way to include an "expand all" and "collapse all". I've updated the demo with the new code using a simple jquery accordion.</p>
  
  <p>The original code should be credited to Ryan Stemkoski at <a href="http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/" rel="nofollow">http://www.stemkoski.com/stupid-simple-jquery-accordion-menu/</a></p>
  
  <p><em><strong>Demo: <a href="http://jsbin.com/ucalu3/5/" rel="nofollow">http://jsbin.com/ucalu3/5/</a></em></strong></p>
  
  <pre><code>$(document).ready(function() { 
    $('.question').click(function() {
  
    if($(this).next().is(':hidden') != true) {
                  $(this).removeClass('active'); 
      $(this).next().slideUp("normal");
    } else {
      $('.question').removeClass('active');  
       $('.answer').slideUp('normal');
      if($(this).next().is(':hidden') == true) {
      $(this).addClass('active');
      $(this).next().slideDown('normal');
       }   
    }
     });
  
    $('.answer').hide();
  
    $('.expand').click(function(event)
      {$('.question').next().slideDown('normal');
          {$('.question').addClass('active');}
      }
    );
  
    $('.collapse').click(function(event)
      {$('.question').next().slideUp('normal');
          {$('.question').removeClass('active');}
      }
    );
  });
  </code></pre>