Tuesday, June 28, 2022
  • Home
  • Event
  • Technology
  • Program
  • Education
No Result
View All Result
I-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

My Dumbest CSS Mistakes | CSS-Tricks

Great Web Development Books You Can Read Free | CSS-Tricks

Top 10 Computer Science Universities in USA 2022

Single Element Loaders: The Bars | 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

Best Lunar New Year Activities and Books for the Classroom

Leave a Reply Cancel reply

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

Popular Posts

Education

Classroom Rules Posters Every Teacher Needs

by admin
June 28, 2022
0

Classroom rules can vary a lot based on age, subject, and many other factors. However, we’ve managed to find five...

Read more

Classroom Rules Posters Every Teacher Needs

My Dumbest CSS Mistakes | CSS-Tricks

Free Word Cloud Generators for Teachers and Students in the Classroom

Your Guide to Teacher Certification Exams in Every State

Sample Recommendation Letters for Scholarship Applications

Seattle beanless coffee brewer Atomo raises $40M and begins selling its sustainable brews online – GeekWire

Load More

Popular Posts

2021 Event Tech Investments and Acquisitions Review

by admin
January 10, 2022
0

Microsoft detected ‘destructive cyberattacks’ against Ukraine hours before Russian invasion

by admin
February 28, 2022
0

2022 Award-Winning Kids Books–Perfect for the Classroom Library

by admin
February 2, 2022
0

Copyright © 2021 - i-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 - I-capitals.com - DESIGNED AND DEVELOPED BY TEAM WORDPRESS BLOGX