Only mark hero as stuck when it should be sticky
This commit is contained in:
parent
520614a3c5
commit
19c45fba8a
1 changed files with 4 additions and 1 deletions
|
@ -25,7 +25,10 @@ function scrollToElement(element, behavior = "smooth") {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleHeroStuck() {
|
function handleHeroStuck() {
|
||||||
if (HERO.getBoundingClientRect().top <= 0) {
|
if (
|
||||||
|
HERO.getBoundingClientRect().top <= 0 &&
|
||||||
|
window.getComputedStyle(HERO).position === "sticky"
|
||||||
|
) {
|
||||||
HERO.classList.add("stuck");
|
HERO.classList.add("stuck");
|
||||||
} else {
|
} else {
|
||||||
HERO.classList.remove("stuck");
|
HERO.classList.remove("stuck");
|
||||||
|
|
Loading…
Reference in a new issue