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
1 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,10 @@ function scrollToElement(element, behavior = "smooth") {
}
function handleHeroStuck() {
if (HERO.getBoundingClientRect().top <= 0) {
if (
HERO.getBoundingClientRect().top <= 0 &&
window.getComputedStyle(HERO).position === "sticky"
) {
HERO.classList.add("stuck");
} else {
HERO.classList.remove("stuck");