MediaWiki:Common.js: Difference between revisions

From Melvor Idle
(replace string literals)
(Added code to resize. Only applies when stickyHeader tables are on the page.)
Line 2: Line 2:


/* Sets the top property for stickyHeader tables */
/* Sets the top property for stickyHeader tables */
 
function setStickyHeaderTop() {
$(document).ready(function () {
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const headHeight = document.getElementById('mw-header-container').offsetHeight;
   const headHeight = document.getElementById('mw-header-container').offsetHeight;
Line 25: Line 24:
     }
     }
   }
   }
});
}
$(document).ready(function () {
  if (document.getElementsByClassName('stickyHeader').length > 0) {
    setStickyHeaderTop();
    $(window).resize(setStickyHeaderTop);
  }
}
);