index-main/assets/js/header.js
isUnknown da2abad099 feat: replace menu opacity hack with proper overlay
- Add #menu-overlay div (fixed, full screen, z-index below menu)
- Overlay fades in/out via opacity+visibility transition (cursor: pointer)
- Click on overlay closes the menu
- Remove opacity: 0.1 hack on main/footer/etc. when menu-open

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 11:50:11 +01:00

35 lines
843 B
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export function headerToggle() {
const header = document.getElementById("site-header");
const buttonToggle = document.querySelector("#menu-toggle");
const overlay = document.getElementById("menu-overlay");
if (!header || !buttonToggle) return;
buttonToggle.addEventListener("click", () => {
document.body.classList.toggle("menu-open");
});
overlay?.addEventListener("click", () => {
document.body.classList.remove("menu-open");
});
}
// DELETE?
export function headerScrollVisibility() {
const header = document.getElementById("site-header");
if (!header) return;
function checkScroll() {
if (window.scrollY >= 300) {
header.classList.add("is-visible");
} else {
header.classList.remove("is-visible");
}
}
window.addEventListener("scroll", checkScroll);
checkScroll();
}