From e27750e915f2c402c6f16812f2765969d433fd32 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Wed, 24 Sep 2025 22:33:47 -0500 Subject: [PATCH] fix load order on scroll when compiled --- server/scripts/modules/currentweatherscroll.mjs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/scripts/modules/currentweatherscroll.mjs b/server/scripts/modules/currentweatherscroll.mjs index 8a447f8..8e3bf50 100644 --- a/server/scripts/modules/currentweatherscroll.mjs +++ b/server/scripts/modules/currentweatherscroll.mjs @@ -12,9 +12,14 @@ const secondsToTicks = (seconds) => Math.ceil((seconds * 1000) / TICK_INTERVAL_M const DEFAULT_UPDATE = secondsToTicks(4.0); // 4 second default for each current conditions // items on page -const mainScroll = document.querySelector('#container>.scroll'); -const fixedScroll = document.querySelector('#container>.scroll .fixed'); -const header = document.querySelector('#container>.scroll .scroll-header'); +let mainScroll; +let fixedScroll; +let header; +document.addEventListener('DOMContentLoaded', () => { + mainScroll = document.querySelector('#container>.scroll'); + fixedScroll = document.querySelector('#container>.scroll .fixed'); + header = document.querySelector('#container>.scroll .scroll-header'); +}); // local variables let interval;