Last active
October 6, 2023 16:07
-
-
Save olibooty/13fbb4468bd61202f4209c1f1245097d to your computer and use it in GitHub Desktop.
A simple way to handle reduced motion preferences with a few lines and one media query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :root { | |
| --prefers-reduced-motion: 1; | |
| @media (prefers-reduced-motion) { | |
| --prefers-reduced-motion: 0; | |
| } | |
| } | |
| @function animationMs($speed) { | |
| @return calc(#{$speed} * var(--prefers-reduced-motion))ms; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .someClass { | |
| animation: slide animationMs(1) ease-in-out infinite; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment