Skip to content

Instantly share code, notes, and snippets.

@batandwa
Created February 6, 2012 12:24
Show Gist options
  • Save batandwa/1751842 to your computer and use it in GitHub Desktop.
Save batandwa/1751842 to your computer and use it in GitHub Desktop.
An accordion that opens on pane at a time but also allows you to close a pane.
$('#accordion .content').hide();
$('#accordion .title').unbind();
$('#accordion .title').click(function() {
$('#accordion .content').slideUp();
if($(this).hasClass('active')) {
$(this).removeClass('active');
return;
}
$(this).addClass('active');
$(this).next().slideDown();
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment