MediaWiki:Gadget-tbody-scroll.js
From cppreference.com
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
$('.tbody-scroll').each(function() { // sync the column widths var rows = $(this).find('tr'); var columns = rows.first().children(); var col_width = columns.map(function() { return $(this).width(); }).get(); rows.each(function() { $(this).children().each(function(i, el) { $(el).width(col_width[i]); }); }); var emulate_thead = function(table) { var rows = table.find('> tbody > tr'); var thead = $('<thead/>'); rows.each(function() { if ($(this).children('td').length > 0) { return false; } thead.append(this); }); table.prepend(thead); return thead; } var tbody = $(this).find('tbody').first(); var thead = $(this).find('thead').first(); if (thead.length == 0) { thead = emulate_thead($(this)); } var height = $(window).height() - thead.height(); $(this).addClass('tbody-scroll-impl'); tbody.css('max-height', height); });