« MediaWiki:Common.js » : différence entre les versions

De eMushpedia
Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 4 : Ligne 4 :
     if ( !panel || !content ) { return; }
     if ( !panel || !content ) { return; }


     // Match the panel height to the content box
     // Set an exact height; min-height would only act as a floor
     function sync() {
     function sync() {
         panel.style.minHeight = content.offsetHeight + 'px';
         panel.style.minHeight = '0';
        panel.style.height = content.getBoundingClientRect().height + 'px';
     }
     }
     sync();
     sync();

Version du 30 juillet 2026 à 02:56

$( function () {
    var panel = document.getElementById( 'mw-panel' );
    var content = document.getElementById( 'content' );
    if ( !panel || !content ) { return; }

    // Set an exact height; min-height would only act as a floor
    function sync() {
        panel.style.minHeight = '0';
        panel.style.height = content.getBoundingClientRect().height + 'px';
    }
    sync();

    // Recompute when the content box changes size
    if ( window.ResizeObserver ) {
        new ResizeObserver( sync ).observe( content );
    } else {
        window.addEventListener( 'resize', sync );
    }
} );