unify header
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s

This commit is contained in:
Julie Blanc 2026-01-22 14:46:05 +01:00
parent d5e458afd8
commit 84f67c88cc
5 changed files with 27 additions and 134 deletions

View file

@ -1,8 +1,6 @@
export function headerToggle() {
const header = document.getElementById("site-header");
const buttonToggle = document.querySelector("#menu-toggle");
console.log(header);
console.log(buttonToggle);
if (!header || !buttonToggle) return;
buttonToggle.addEventListener("click", () => {
@ -12,32 +10,18 @@ export function headerToggle() {
export function headerScrollVisibility() {
const header = document.getElementById("site-header");
const hero = document.getElementById("hero");
if (!header) return;
function checkScroll() {
if (hero) {
// Comportement avec hero
const headerHeight = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--header-h')) || 0;
const heroBottom = hero.getBoundingClientRect().bottom;
if (heroBottom <= headerHeight) {
header.classList.add("is-visible");
} else {
header.classList.remove("is-visible");
}
if (window.scrollY >= 300) {
header.classList.add("is-visible");
} else {
// Comportement sans hero \
if (window.scrollY >= 300) {
header.classList.add("is-visible");
} else {
header.classList.remove("is-visible");
}
header.classList.remove("is-visible");
}
}
window.addEventListener("scroll", checkScroll);
checkScroll(); // Vérifier au chargement
checkScroll();
}