From 248c5df019f1b15feb7ceaa4c5195dd41b0784e6 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 17 Sep 2024 13:21:00 +0100 Subject: [PATCH] Update app-optimization.liquid Adds extra listeners to allow for non-scrolling pages --- App Optimization/app-optimization.liquid | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/App Optimization/app-optimization.liquid b/App Optimization/app-optimization.liquid index baba614..212d851 100644 --- a/App Optimization/app-optimization.liquid +++ b/App Optimization/app-optimization.liquid @@ -131,10 +131,12 @@ var eventFn = partial(loadOnScroll, loadRule.originalUrl); var eventOptions = supportsPassive ? {passive: true} : false; window.addEventListener('scroll', eventFn, eventOptions); + window.addEventListener('mousemove', eventFn, eventOptions); + window.addEventListener('touchstart', eventFn, eventOptions); function loadOnScroll(src) { loadScript(src); - window.removeEventListener('scroll', eventFn, eventOptions); + window.removeEventListener(event.type, eventFn, eventOptions); } }