Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should carousel stop autoplay when user’s reduce motion is true (prefers-reduced-motion: reduce) in OS? #45

Open
Domchocolate opened this issue Mar 3, 2024 · 0 comments

Comments

@Domchocolate
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant