![]() ![]() There's actually a library that helps with that so implementation isn't a problem, but it's quite the added runtime cost for such a small feature, so I decided against it. ![]() Yep, it's definitely hacky (but totally works)! □īut afaik it's the only reliable way to detect CSS unknown to the browser without having to collect/fetch every single stylesheet on a page (with something like getElementsByTagName), parse through all of them with a Regex and repeat that every time some styles change. ![]() Safari supports it, but Safari doesn't support smooth scrolling. Unfortunately, Chrome does not support this. Setting up smooth scrolling is incredibly easy now, though browser support for this isnt 100 yet Also, a massive thank you to all of you Ive recently hi. To circumvent this you can wrap the CSS property in a prefers-reduced-motion media query. People might get motion sickness when watching the animation. We could use Smart CSS to detect long pages and conditionally apply the smooth scroll style. If there is a lot of distance to travel, Firefox will skip content to keep the scroll time-limited, while Chrome has a max velocity and will just take its time to get to the target. resize-none resize-y resize-x resize scroll-auto scroll-smooth scroll-p- (padding) scroll-px- scroll-py- scroll-pt- (padding-top) Caret Color inherit. We can set the scroll-behavior property to the container we want to exhibit smooth scroll behavior and we're done.īefore we go nuts and apply this to all our sites, there are a couple of things we need to keep in mind. Turns out there's a scroll-behavior CSS property that we can set to smooth, it's literally that literal. Then, Hans Spieß points out that this can also be done with CSS, WHAT!? I posted it on Twitter and called it a day.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |