Account for pages not having a hero

Eg the homepage
This commit is contained in:
Jake Howard 2023-11-27 20:10:35 +00:00
parent 6996e191e5
commit 1c9e1b4f74
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 7 additions and 7 deletions

View File

@ -91,8 +91,13 @@ window.addEventListener("load", () => {
});
window.addEventListener("DOMContentLoaded", () => {
setHeroHeight();
handleHeroStuck();
if (HERO) {
setHeroHeight();
handleHeroStuck();
window.addEventListener("resize", debounce(setHeroHeight, 2000));
window.addEventListener("scroll", throttle(handleHeroStuck, 100));
}
if (window.location.hash <= 1) {
return;
@ -111,8 +116,3 @@ window.addEventListener("DOMContentLoaded", () => {
scrollToElement(scrollTarget, "auto");
});
if (HERO) {
window.addEventListener("resize", debounce(setHeroHeight, 2000));
window.addEventListener("scroll", throttle(handleHeroStuck, 100));
}