Manual if gt than hide, then expand collapse

/ Published in: jQuery
Save to your folder(s)

Use Collapsorz

Copy this code and paste it in your HTML
  1. $('.ukn-tags-related-inline ol.ukn-style-1 li:gt(4)').hide();
  2. $('.ukn-tags-related-inline ol.ukn-style-1').append('<li><a class="ukn-toggler ukn-j-tipsy" title="Show more tags" href="#"><span>+</span></a></li>');
  3. $('.ukn-tags-related-inline ol.ukn-style-1 li a.ukn-toggler').toggle(function(e) {
  4. e.preventDefault();
  5. $(this).attr('title', 'Show less tags').html('<span>-</span>').parent().parent().addClass('ukn-active');
  6. $('.ukn-tags-related-inline ol.ukn-style-1 li:gt(4)').show();
  7. }, function() {
  8. $(this).attr('title', 'Show more tags').html('<span>+</span>').parent().parent().removeClass('ukn-active');
  9. $('.ukn-tags-related-inline ol.ukn-style-1 li:gt(4):not(:last)').hide();
  10. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.