Scroll-Driven Animations Inside a CSS Carousel

0
942

Scroll-Driven Animations Inside a CSS Carousel | CSS-Tricks

I was reflecting on what I learned about CSS Carousels recently. There’s a lot they can do right out of the box (and some things they don’t) once you define a scroll container and hide the overflow.

Hey, isn’t there another fairly new CSS feature that works with scroll regions? Oh yes, that’s Scroll-Driven Animations. Shouldn’t that mean we can trigger an animation while scrolling through the items in a CSS carousel?

Why yes, that’s exactly what it means. At least in Chrome at the time I’m playing with this:

It’s as straightforward as you might expect: define your keyframes and apply them on the carousel items:

@keyframes foo {
  from {
    height: 0;
  }
  to {
    height: 100%;
    font-size: calc(2vw + 1em);
  }
}

.carousel li {
  animation: foo linear both;
  animation-timeline: scroll(inline);
}

There are more clever ways to animate these things of course. But what’s interesting to me is that this demo now combines CSS Carousels with Scroll-Driven Animations. The only rub is that the demo also slaps CSS Scroll Snapping in there with smooth scrolling, which is effectively wiped out when applying the scroll animation.

I thought I might work around that with a view() timeline instead. That certainly makes for a smoother animation that is applied to each carousel item as they scroll into view, but no dice on smooth scrolling.

Спонсоры
Спонсоры
Спонсоры
Спонсоры
Спонсоры
Поиск
Спонсоры
Virtuala FansOnly
CDN FREE
Cloud Convert
Категории
Больше
Sports
What Is Digital Marketing? Types, Examples, & Strategy
digital marketing, online marketing, marketing strategy, SEO, types of digital marketing, digital...
От Joseph Luke 2026-01-21 08:05:31 0 62
Другое
FOTO "Razbili su mi auto i skinuli Dinamovu zastavicu. Hvala počinitelju što je djeci uništio ljetovanje"
FOTO 'Razbili su mi auto i skinuli Dinamovu zastavicu. Hvala počinitelju što je djeci...
От Drago Merkaš 2025-06-13 15:14:57 0 1Кб
Другое
Edge Computing in Healthcare Market, Size, Share, Growth and forecast (2024-2032)
According to the UnivDatos, the rising adoption of IoT in medical devices will drive the global...
От Praveen Gupta 2025-12-29 06:28:20 0 433
Art
**Descubre los siete universos ocultos en experiencias de realidad virtual que nunca has visto**
realidad virtual, experiencias VR, mundos ocultos, escapismo, tecnología, inmersión, emociones,...
От Miguel Felipe 2025-08-27 19:05:21 1 699
Art
Questa Settimana nella Sicurezza: Nonsense di DEF CON, Vibepwned e 0-days
## Introduzione Negli ultimi giorni, il mondo della sicurezza informatica ha visto un certo...
От Nicola Diego 2025-08-29 19:05:23 1 2Кб
Спонсоры
Virtuala FansOnly https://virtuala.site