Only mark hero as stuck when it should be sticky

This commit is contained in:
Jake Howard 2023-10-16 21:42:39 +01:00
parent 520614a3c5
commit 19c45fba8a
Signed by: jake
GPG Key ID: 57AFB45680EDD477

View File

@ -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");