MediaWiki:Common.js: Difference between revisions

Fix sticky header on mobile resolutions (take 2)
(Undo revision 56082 by Auron956 (talk))
Tag: Undo
(Fix sticky header on mobile resolutions (take 2))
Line 523: Line 523:
function setStickyHeaderTop() {
function setStickyHeaderTop() {
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const headHeight = document.getElementById('mw-header-container').offsetHeight;
   const headStyles = getComputedStyle(document.getElementById('mw-header-container'));
  var headHeight = document.getElementById('mw-header-container').offsetHeight;
  if (headStyles !== undefined && headStyles.display !== 'fixed') {
    headHeight = 0;
  }
   for (var i = 0; i < stickyTables.length; i++) {
   for (var i = 0; i < stickyTables.length; i++) {
     const firstRow = stickyTables[i].getElementsByClassName('headerRow-0');
     const firstRow = stickyTables[i].getElementsByClassName('headerRow-0');