Smooth Scrolling for Screencasts
Smooth Scrolling for Screencasts

Share this: Let’s say you wanted to scroll a web page from top to bottom programmatically. For example, you’re recording a screencast and want a nice full-page scroll. You probably can’t scroll it yourself because it’ll be all uneven and jerky. Native JavaScript can do smooth scrolling. Here’s a tiny snippet that might do the... » read more

Styling Based on Scroll Position
Styling Based on Scroll Position

<![CDATA[ ]]> Share this: 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... » read more

Dealing with overflow and position: sticky;
Dealing with overflow and position: sticky;

The old way Telling an element to behave both stickily and static in the browser window is somewhat challenging. Before (modern) browsers introduced a native solution, we had to resort to faking sticky behaviors (e.g., for headers, sidebars etc.) using javascript and position: fixed;. Javascript listens for scroll events and the element’s position in the document,... » read more