From 4180752d428ebdcd15a919e3e62827eef852b0c3 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:19:33 +0800 Subject: [PATCH] Rename scroll position variable --- src/_includes/main/navbar.njk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_includes/main/navbar.njk b/src/_includes/main/navbar.njk index 5daa33c6..d3e5bb1d 100644 --- a/src/_includes/main/navbar.njk +++ b/src/_includes/main/navbar.njk @@ -65,9 +65,9 @@ // const hero = document.querySelector(".hero"); const navbar = document.querySelector(".navbar"); window.addEventListener("scroll", () => { - const scrollPos = window.scrollY || document.documentElement.scrollTop; + const scrollPosition = window.scrollY || document.documentElement.scrollTop; const stickyLine = hero.scrollHeight - navbar.scrollHeight; - if (scrollPos > stickyLine) { + if (scrollPosition > stickyLine) { navbar.classList.add("nav--sticky"); } else { navbar.classList.remove("nav--sticky");