Skip to content

Commit 9af116c

Browse files
committed
Enhance AOS initialization to respect user preferences for reduced motion
1 parent 1fe28ce commit 9af116c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spock-website/src/main.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import './style.css'
22
import './icons'
33
import AOS from 'aos'
44

5+
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6+
const disableAosByQuery = new URLSearchParams(window.location.search).get('disableaos') !== null;
7+
58
AOS.init({
69
duration: 800, // Animation duration
710
once: true, // Whether animation should happen only once - while scrolling down
811
offset: 50, // Offset (in px) from the original trigger point
9-
disable: new URLSearchParams(window.location.search).get('disableaos') !== null,
12+
disable: prefersReducedMotion || disableAosByQuery,
1013
});

0 commit comments

Comments
 (0)