Skip to content

Instantly share code, notes, and snippets.

@LBRapid
Created July 22, 2010 15:24
Show Gist options
  • Save LBRapid/486114 to your computer and use it in GitHub Desktop.
Save LBRapid/486114 to your computer and use it in GitHub Desktop.
$('ul .tags').each(function() {
$(this).children('li:gt(4)').hide();
$('li:4').after('<li><a href="#" class="show-hide-tags" data-open="0">[More]</a></li>');
});
$('.show-hide-tags').click(function(e) {
e.preventDefault();
var $this = $(this);
if ($this.attr('data-open') == "0") {
$this.text("[Less]");
$this.attr('data-open', '1');
} else {
$this.text("[More]");
$this.attr('data-open', '0');
}
$this.prev('ul').children('li:gt(4)').toggle();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment