Remove declaration of header variable
This commit is contained in:
parent
e8841afa78
commit
bd2e9cfcee
|
@ -62,12 +62,11 @@
|
|||
|
||||
<script webc:keep webc:bucket="defer">
|
||||
// Make the navigation bar sticky
|
||||
const header = document.querySelector(".main-header");
|
||||
const navbar = document.querySelector("navbar");
|
||||
|
||||
window.addEventListener("scroll", e => {
|
||||
const scrollPos = window.scrollY || document.documentElement.scrollTop;
|
||||
const stickyLine = header.scrollHeight - navbar.scrollHeight;
|
||||
const stickyLine = document.querySelector(".main-header").scrollHeight - navbar.scrollHeight;
|
||||
if (scrollPos > stickyLine) {
|
||||
navbar.classList.add("sticky-nav");
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue