Direct link to the article How to Play and Pause CSS Animations with CSS Custom Properties

How to Play and Pause CSS Animations with CSS Custom Properties

Let’s have a look CSS @keyframes animations, and specifically about how you can pause and otherwise control them. There is a CSS property specifically for it, that can be controlled with JavaScript, but there is plenty of nuance to get …

Avatar of Mads Stoumann
Mads Stoumann on
Direct link to the article A Few Functional Uses for Intersection Observer to Know When an Element is in View

A Few Functional Uses for Intersection Observer to Know When an Element is in View

You might not know this, but JavaScript has stealthily accumulated quite a number of observers in recent times, and Intersection Observer is a part of that arsenal. Observers are objects that spot something in real-time — like birdwatchers going to …

Avatar of Preethi
Preethi on
Direct link to the article Using IntersectionObserver to Check if Page Scrolled Past Certain Point

Using IntersectionObserver to Check if Page Scrolled Past Certain Point

When a web page scrolls, that’s a DOM event. I can find out how far a window has scrolled at any time with window.scrollY. I can listen for that event and get that number:

window.addEventListener("scroll", () ={
  console.log(window.scrollY)
Avatar of Chris Coyier
Chris Coyier on (Updated on )