Skip to content

Instantly share code, notes, and snippets.

@mikedugan
Created November 7, 2013 14:33
Show Gist options
  • Select an option

  • Save mikedugan/7355501 to your computer and use it in GitHub Desktop.

Select an option

Save mikedugan/7355501 to your computer and use it in GitHub Desktop.
collapses an item with the given class
function collapsePost() {
$('a.colPost').click(function(event) {
event.preventDefault();
$(this).toggleClass('collapsed');
if($(this).hasClass('collapsed')) {
$(this).text('Expand'); }
else {$(this).text('Collapse');}
var post = $(this).parent().parent().children('.content');
var author = post.siblings('.postInfo');
author.toggleClass('postcollapsed'); post.toggle();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment