From 34368d9802cd17df24a014bc75e5f6ce433dacfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Thu, 11 Dec 2025 16:56:05 +0100 Subject: [PATCH] Enhance AOS initialization to respect user preferences for reduced motion --- spock-website/src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spock-website/src/main.ts b/spock-website/src/main.ts index 498c26e..5dd0179 100644 --- a/spock-website/src/main.ts +++ b/spock-website/src/main.ts @@ -2,9 +2,12 @@ import './style.css' import './icons' import AOS from 'aos' +const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; +const disableAosByQuery = new URLSearchParams(window.location.search).get('disableaos') !== null; + AOS.init({ duration: 800, // Animation duration once: true, // Whether animation should happen only once - while scrolling down offset: 50, // Offset (in px) from the original trigger point - disable: new URLSearchParams(window.location.search).get('disableaos') !== null, + disable: prefersReducedMotion || disableAosByQuery, });