replace all w3-include
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s
This commit is contained in:
parent
1570d62287
commit
4642425f43
26 changed files with 283 additions and 80 deletions
33
assets/js/header.js
Normal file
33
assets/js/header.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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", () => {
|
||||
document.body.classList.toggle("menu-open");
|
||||
});
|
||||
}
|
||||
|
||||
export function headerScrollVisibility() {
|
||||
const header = document.getElementById("site-header");
|
||||
const hero = document.getElementById("hero");
|
||||
|
||||
if (!header || !hero) return;
|
||||
|
||||
function checkScroll() {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("scroll", checkScroll);
|
||||
checkScroll(); // Vérifier au chargement
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue