Skip to main content

Published by Michael Spellacy (Spell) on

Repost of

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.matches);

  // Stop JavaScript animation