Skip to content

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

@Domchocolate

Description

@Domchocolate

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions