Nice post here about “sticky” navigations and prefers-reduced-motion
, which I have also been using more and more often. In addition to CSS, don’t forget that you can do it in JavaScript, too.
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
mediaQuery.addEventListener("change", () => {
console.log(mediaQuery.media, mediaQuery.matches);
// Stop JavaScript animation
});