Anonymous

MediaWiki:Common.js: Difference between revisions

From Melvor Idle
Amend sticky headers to avoid compatibility issues with tabber containers
(Adjust for Chrome/Firefox issue where missing border leaves a thin, transparent line for multi-row headers)
(Amend sticky headers to avoid compatibility issues with tabber containers)
Line 555: Line 555:


$(document).ready(function () {
$(document).ready(function () {
if (document.getElementsByClassName('stickyHeader').length > 0) {
const elemSticky = document.getElementsByClassName('stickyHeader');
if (elemSticky.length > 0) {
// Sticky headers do not function well when Tabber containers/article tags.
// Therefore identify any stickyHeader tables within these containers
//  and remove the stickyHeader class
const elemArticle = document.getElementsByTagName('article');
if (elemArticle.length > 0) {
for (var kS = 0; kS < elemSticky.length; kS++) {
for (var kA = 0; kA < elemArticle.length; kA++) {
const eSticky = elemSticky[kS];
const eArticle = elemArticle[kA];
if (eArticle.contains(eSticky)) {
eSticky.classList.remove('stickyHeader');
}
}
}
}
setStickyHeaderTop();
setStickyHeaderTop();
$(window).resize(setStickyHeaderTop);
$(window).resize(setStickyHeaderTop);