User:Sur/common.js: Difference between revisions
< User:Sur
m Blanked the page Tags: Blanking Manual revert |
mNo edit summary |
||
Line 1: | Line 1: | ||
document.addEventListener('DOMContentLoaded', function() { | |||
const infoboxes = document.querySelectorAll('.stat-infobox'); | |||
infoboxes.forEach(function(infobox) { | |||
const hoverBox = infobox.querySelector('.stat-infobox-hover'); | |||
const table = hoverBox.querySelector('.stat-infobox-table'); | |||
// On hover, adjust the height of the stat-infobox to match the hover box | |||
infobox.addEventListener('mouseenter', function() { | |||
const hoverHeight = hoverBox.offsetHeight; | |||
infobox.style.height = hoverHeight + 'px'; | |||
}); | |||
// Reset height when hover ends | |||
infobox.addEventListener('mouseleave', function() { | |||
infobox.style.height = 'auto'; | |||
}); | |||
}); | |||
}); |
Revision as of 18:29, 22 September 2024
document.addEventListener('DOMContentLoaded', function() {
const infoboxes = document.querySelectorAll('.stat-infobox');
infoboxes.forEach(function(infobox) {
const hoverBox = infobox.querySelector('.stat-infobox-hover');
const table = hoverBox.querySelector('.stat-infobox-table');
// On hover, adjust the height of the stat-infobox to match the hover box
infobox.addEventListener('mouseenter', function() {
const hoverHeight = hoverBox.offsetHeight;
infobox.style.height = hoverHeight + 'px';
});
// Reset height when hover ends
infobox.addEventListener('mouseleave', function() {
infobox.style.height = 'auto';
});
});
});