正在加载视频...
视频加载失败
Future CSS Tip! 🍏 You can create this Apple-style photo scroller by combining CSS scroll-driven animations and CSS scroll-snap 😍 Peep those changing captions 👀 No JS! img { animation: highlight both linear; animation-timeline: view(inline); 👈 Horizontal animation-range: cover 0% cover 50%; 👈 Finish } @ keyframes highlight {... show more
11 条评论

Here's that @CodePen link! 🚀 You need to be in Chrome to see this in action 📜 But, how cool? CSS only list animations that could work as a progressive enhancement ✨ If they aren't supported, your user still gets a good experience 🙌

And here's the original piece of UI from the iPhone 15 Pro page 🤙 The CodePen demo isn't quite as "polished". But, it's proving the concept of what we can achieve 🔥 The iPhone page uses JavaScript to update the transform matrix of the images via inline styles as you scroll. Think if you mess with the timing a little, it could be spot-on in the CSS-only version 💯 Maybe using some of the linear() stuff from recent weeks 🤔

This guy makes me feel I didn’t learn CSS 😂

Haha – You now CSS 😉 But, it's constantly evolving.

👏🏼👏🏼🙌🏼

Thanks Oscar 🙏

CSS scroll snap is insanely powerful

The undercover goat 🐐😅

🤯

Sick! Would there be any possibility to start them from display none as well? Could create a “lazy loader” purely with CSS, as I recall the browser doesn’t load resources such as images when it’s set to display: none. Maybe in combination with :has and :visible.

I need to revisit this demo today 🤞 Wanted to add an intro animation to it too. One trick here is that it's all the same image for this purpose but cropped with object-view-box. Perhaps, animating stepped with display and using a preload perhaps 🤔That's off the top of my head
