Skip to content

View Transitions API

Resources

Documentation

Other

Blog posts

Videos

Demos

CodePens

Demo sites

prefers-reduced-motion

Respect the user and don't display the transition animations if they are not wanted. This can be done with CSS or JavaScript.

/* CSS */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}
// JavaScript
window.matchMedia('(prefers-reduced-motion: reduce)').matches

More: https://web.dev/prefers-reduced-motion/