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

View file

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