Skip to content

Commit

Permalink
Fix: navbar-items scrollbar doesn't show up when nav items are expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
julianbyte committed Dec 11, 2024
1 parent f11edaf commit f7c2763
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions layouts/partials/page/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)`;
}
});
});
</script>

{{ if $.Site.Params.resizeMenu | default true }}
Expand Down

0 comments on commit f7c2763

Please sign in to comment.