Does this library support reduced motion? #7912
-
Title self explanatory, for accessibility users. |
Beta Was this translation helpful? Give feedback.
Answered by
edwin-shdw
Mar 11, 2025
Replies: 1 comment 1 reply
-
Seems like Swiper doesn’t handle this automatically, but you can easily implement it yourself: function usesReducedMotion() {
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
}
new Swiper(".swiper", {
speed: usesReducedMotion() ? 0 : 300,
effect: usesReducedMotion() ? 'fade' : 'slide',
}); Setting However, I think it should respect the reduced motion setting by default. At least it wouldn't harm anyone. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
IDrumsey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like Swiper doesn’t handle this automatically, but you can easily implement it yourself:
Setting
speed
to0
removes transition animations and using thefade
effect instead ofslide
prevents unnecessary motion when dragging.However, I think it should respect the reduced motion setting by default. At least it wouldn't harm anyone.
I would like to implement this if you're cool with the idea @nolimits4web