diff --git a/layouts/partials/page/script.html b/layouts/partials/page/script.html index a76b2c88..a838745e 100644 --- a/layouts/partials/page/script.html +++ b/layouts/partials/page/script.html @@ -86,6 +86,25 @@ 'lineColor': '#666', }, }); + + document.addEventListener("DOMContentLoaded", function () { + const navbarHeader = document.querySelector(".navbar-header"); + const navbarItems = document.querySelector(".navbar-items"); + + if (navbarHeader && navbarItems) { + // Calculate the dynamic height and apply it + const headerHeight = navbarHeader.offsetHeight; + navbarItems.style.maxHeight = `calc(100vh - ${headerHeight}px)`; + } + + // Optional: Adjust height dynamically during window resize + window.addEventListener("resize", function () { + if (navbarHeader && navbarItems) { + const headerHeight = navbarHeader.offsetHeight; + navbarItems.style.maxHeight = `calc(100vh - ${headerHeight}px)`; + } + }); + }); {{ if $.Site.Params.resizeMenu | default true }}