Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 7, 2019 03:26 pm GMT

Styling Based on Scroll Position

Rik Schennink documents a system for being able to write CSS selectors that style a page when it has scrolled to a certain point. If you're like me, you're already on the lookout for document.addEventListener('scroll' ... and being terrified about performance. Rik gets to that right away by both debouncing the function as well as marking the event as passive.

The end result is a data-scroll attribute on the <html> element that can be used in the CSS. Meaning … Read article

The post Styling Based on Scroll Position appeared first on CSS-Tricks.


Original Link: https://css-tricks.com/styling-based-on-scroll-position/

Share this article:    Share on Facebook
View Full Article

CSS Tricks

A Web Design Community curated by Chris Coyier

More About this Source Visit CSS Tricks