hover nav
This commit is contained in:
parent
3ea41b5cf0
commit
2df3106031
6 changed files with 36 additions and 13 deletions
|
|
@ -14,16 +14,26 @@ export function headerScrollVisibility() {
|
|||
const header = document.getElementById("site-header");
|
||||
const hero = document.getElementById("hero");
|
||||
|
||||
if (!header || !hero) return;
|
||||
if (!header) return;
|
||||
|
||||
function checkScroll() {
|
||||
const headerHeight = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--header-h')) || 0;
|
||||
const heroBottom = hero.getBoundingClientRect().bottom;
|
||||
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");
|
||||
if (heroBottom <= headerHeight) {
|
||||
header.classList.add("is-visible");
|
||||
} else {
|
||||
header.classList.remove("is-visible");
|
||||
}
|
||||
} else {
|
||||
header.classList.remove("is-visible");
|
||||
// Comportement sans hero \
|
||||
if (window.scrollY >= 300) {
|
||||
header.classList.add("is-visible");
|
||||
} else {
|
||||
header.classList.remove("is-visible");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue