User:Sur/common.js: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
mNo edit summary
Sur (talk | contribs)
m Blanked the page
Tags: Blanking Manual revert
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 19:50, 22 September 2024