Skip to content

Instantly share code, notes, and snippets.

@christophermlne
Created August 23, 2013 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophermlne/6319571 to your computer and use it in GitHub Desktop.
Save christophermlne/6319571 to your computer and use it in GitHub Desktop.
Basic code to enable a nested ul structure to be open and closed at any level by the user
$('h3').click(function(){
var t = $(this);
if (t.hasClass('open')) {
t.removeClass('open');
t.siblings('ul').hide();
} else {
t.addClass('open');
t.siblings('ul').show();
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment