Sha256: ff3d083378dc10b4bf42b0959e9f7d4427215a56adfeb9edf47944dbc5e52e75
Contents?: true
Size: 1.03 KB
Versions: 11
Compression:
Stored size: 1.03 KB
Contents
var numShown = 5; // Initial rows shown & index var numMore = 5; // Increment var $table = $('table.hidden_rows').find('tbody'); // tbody containing all the rows var numRows = $table.find('tr').length; // Total # rows $(function () { // Hide rows and add clickable div $table.find('tr:gt(' + (numShown - 1) + ')').hide().end() .after('<tbody id="more"><tr><td colspan="' + $table.find('tr:first td').length + '"><div>Show <span>' + numMore + '</span> More</div</tbody></td></tr>'); $('#more').click(function() { numShown = numShown + numMore; // no more "show more" if done if (numShown >= numRows) { $('#more').remove(); } // change rows remaining if less than increment if (numRows - numShown < numMore) { $('#more span').html(numRows - numShown); } $table.find('tr:lt(' + numShown + ')').show(); }); $('#all').click(function() { $table.find('tr:lt(' + numRows + ')').show(); }); });
Version data entries
11 entries across 11 versions & 1 rubygems