Friday, May 27, 2022
  • Home
  • Event
  • Technology
  • Program
  • Education
No Result
View All Result
E-Capitals
No Result
View All Result
Home Program

CSS Scroll-Timeline With Motion Preference | CSS-Tricks

admin by admin
January 31, 2022
in Program
0
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

Related Posts

Just How Long Should Alt Text Be? | CSS-Tricks

Beautify GitHub Profile | CSS-Tricks

Cool CSS Hover Effects That Use Background Clipping, Masks, and 3D | CSS-Tricks

Customizing Color Fonts on the Web | CSS-Tricks

Lemme do this one quick-hits style:

CSS Scroll-Timeline with prefers-reduced-motion

The only thing I’d add is something to honor prefers-reduced-motion, as I could see this sort of scrolling motion affecting someone with motion sickness. To do that, you could combine tests in the same line the support test is being done in JavaScript:

if (
    !CSS.supports("animation-timeline: foo") && 
    !window.matchMedia('(prefers-reduced-motion: reduce)').matches
   ) {
     // Do fancy stuff
}

I’m not 100% if it’s best to test for no-preference or the opposite of reduce. Either way, the trick in CSS is to wrap anything you’re going to do with @scroll-timeline and animation-timeline in an @supports test (in case you want to do something different otherwise) and then wrap that in a preference test:

@media (prefers-reduced-motion: no-preference) {

    @supports (animation-timeline: works) {

      /* Do fancy stuff */

    }

}

Here’s a demo of that, with all the real credit to Bramus here for getting it going.

Ooo and ya know what? The CSS gets nicer should @when land as a feature:

@when supports(animation-timeline: works) and media(prefers-reduced-motion: no-preference) {

} @else {

}
Next Post

How Teachers Are Using Wordle in the Classroom

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular Posts

Technology

Robotic exoskeleton startup wins Oregon life and biosciences angel competition – GeekWire

by admin
May 27, 2022
0

Biomotum’s SPARK device for rehabilitation of individuals with cerebral palsy, stroke, and other neurological conditions. (Biomotum Photo) Wearable robotics startup...

Read more

Robotic exoskeleton startup wins Oregon life and biosciences angel competition – GeekWire

Seattle startup JetClosing, which launched in 2016 to digitize home closing process, is shutting down – GeekWire

Seattle University aims to boost entrepreneurship – GeekWire

Fishery monitoring software wins $25K at Univ. of Washington student startup competition – GeekWire

Elizabeth Scallon departs Amazon for HP; Fauna hires marketing exec; and more – GeekWire

Just How Long Should Alt Text Be? | CSS-Tricks

Load More

Popular Posts

Best Winter Olympics Activities for Kids in the Classroom

by admin
January 19, 2022
0

What is Packet Sniffing Attack? – Types and How to Prevent It?

by admin
December 11, 2021
0

Zain Nadella, 1996-2022: Microsoft CEO’s son remembered for love of music, bright smile, profound impact on his dad

by admin
March 1, 2022
0

Copyright © 2021 - e-Capitals.com DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX

No Result
View All Result
  • Home
    • Home 1
    • Home 2
    • Home 3
  • Event
  • Technology
  • Program
  • Education

Copyright © 2021 - e-capitals.com - DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX