Sha256: 33334f9ede5ccab63edbdc5b1480358ea0cc303545bfbbbaa2675975ea052691

Contents?: true

Size: 1.17 KB

Versions: 455

Compression:

Stored size: 1.17 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() {
        numShown = numRows;
        // no more "show more" if done
        if (numShown >= numRows) {
            $('#all').remove();
        }
        $table.find('tr:lt(' + numShown + ')').show();
    });

});

Version data entries

455 entries across 455 versions & 2 rubygems

Version Path
jumbo-jekyll-theme-5.7.0 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.9.4 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.9.3 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.9.2 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.9.1 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.9 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.8 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.7 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.6 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.5 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.4 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.3 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.2 assets/js/app/tables.js
jumbo-jekyll-theme-5.6.0 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.6 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.5 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.4 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.3 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.2 assets/js/app/tables.js
jumbo-jekyll-theme-5.5.1 assets/js/app/tables.js