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
 
(5 intermediate revisions by the same user not shown)
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';
        });
    });
});

Latest revision as of 00:47, 23 September 2024