function updateHeaderHeight() {
        // Get the height of #brx-header
        const headerHeight = document.querySelector('#brx-header').offsetHeight;
          
        // Store the height in the CSS custom property --header-height
        document.documentElement.style.setProperty('--brxw-header-height', headerHeight + 'px');
    }

    // Execute the function as soon as the document is ready
    document.addEventListener('DOMContentLoaded', function() {
        updateHeaderHeight();  // Initial update of header height when the document is ready

        // Update the header height on window resize and orientation change
        window.addEventListener('resize', updateHeaderHeight);
        window.addEventListener('orientationchange', updateHeaderHeight);
});

eugenio-rodriguez

Eugenio Rodríguez Martos

I have been writing for Diario de Ibiza since June 2006. I primarily cover politics, urban planning, and environmental news on the island. Previously, I worked for Diari de Balears, La Voz de Mallorca, El Mundo de Balears, La Veu de Menorca, El Mundo de Ibiza y Formentera, and Última Hora de Ibiza y Formentera.