It would be great if the carousel would stop autoplay when user’s reduce motion is true (prefers-reduced-motion: reduce) in OS?
I can get this to work but it removes the previous/next buttons so we’re left with the first slide visible and navigable.
`// Check if the user prefers reduced motion
const prefersReducedMotion = window.matchMedia(‘(prefers-reduced-motion: reduce)’).matches;
// Set autoplay based on the user’s preference
const autoplayEnabled = !prefersReducedMotion;
const slider = new A11YSlider(document.querySelector(‘.slider’), {
adaptiveHeight: true,
dots: true,
arrows: true,
autoplay: autoplayEnabled,
autoplaySpeed: 5000
});`
Any ideas on how we get this to work?
It would be great if the carousel would stop autoplay when user’s reduce motion is true (prefers-reduced-motion: reduce) in OS?
I can get this to work but it removes the previous/next buttons so we’re left with the first slide visible and navigable.
`// Check if the user prefers reduced motion
const prefersReducedMotion = window.matchMedia(‘(prefers-reduced-motion: reduce)’).matches;
// Set autoplay based on the user’s preference
const autoplayEnabled = !prefersReducedMotion;
const slider = new A11YSlider(document.querySelector(‘.slider’), {
adaptiveHeight: true,
dots: true,
arrows: true,
autoplay: autoplayEnabled,
autoplaySpeed: 5000
});`
Any ideas on how we get this to work?