Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

#CSS scroll-driven animation + scroll snap events synchronized with a number input scrollSnapChange is lazy: used to update the blue highlight feedback UX scrollSnapChanging is eager: used to immediately update the number input value to match the snapped item set to ship in Chrome 129 snap events available to...

61,950 görüntüleme • 1 yıl önce •via X (Twitter)

10 Yorum

Adam Argyle profil fotoğrafı
Adam Argyle1 yıl önce

it's really nice to be able to trigger transitions from scroll snap so easily, make interrupting them no big deal

Adam Argyle profil fotoğrafı
Adam Argyle1 yıl önce

another teaser video: this one progressively enhances the interaction to add the staggering only if the user is cool with motion and has snap events in their browser

Adam Argyle profil fotoğrafı
Adam Argyle1 yıl önce

Demo test on Android, in Canary with web experiments enabled

GD Steve profil fotoğrafı
GD Steve1 yıl önce

That's so cool 🔥

Ahmad Shadeed profil fotoğrafı
Ahmad Shadeed1 yıl önce

Wow 😍

7hw3dm4p0 profil fotoğrafı
7hw3dm4p01 yıl önce

I LITERALLY WANTED TO BUILD SOMETHING LIKE I COUDLN'T LAST YEAR SO I SETTLED FOR THIS ON MY BLOB OMG

Ivan B profil fotoğrafı
Ivan B1 yıl önce

Looks cool 😎. On a semi-related note: what software did your use to record the video with those mouse cursors? I've been looking for something like that but haven't found anything yet :/

Adam Argyle profil fotoğrafı
Adam Argyle1 yıl önce

I used Kap and emulated touch via devtools 🤘

🍥kvndy profil fotoğrafı
🍥kvndy1 yıl önce

I hope this works for an inline child element on container resize. Resizing a container to become narrower causes an inline child element to move below the bottom of the viewport as container scrollHeight increases, which I want to prevent.

dgr^esm profil fotoğrafı
dgr^esm1 yıl önce

@blog2t Check it out!

Benzer Videolar

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 { 50% { translate: 0 0; scale: var(--starting-scale); 👈 props opacity: var(--starting-opacity); 👈 } 100% { translate: 0 0; scale: 1; opacity: 1; } } Without the animation support, you get a standard unordered list containing some s 🤙 How do we swap the captions though? The "trick" is to use position: absolute on the figcaption and animate their opacity based on the ViewTimeline of their parent list item 😎 figcaption { animation: show both linear; animation-timeline: --list-item; } @ keyframes show { 0%, 45%, 55%, 100% { opacity: 0; } 50% { opacity: 1; } } li { view-timeline-name: --list-item; view-timeline-axis: inline; 👈 important! } The parent of the scroll track uses position: relative so all the captions sit in the middle even though they are in the right place for the markup 🙌 The last bit is the scroll-snap 🤙 Not much to it at all. Wrap the list and make it scrollable. Then add scroll-snap-type .wrapper { scroll-snap-type: x mandatory; overflow-x: scroll; } Then make sure each list item has scroll-snap-align set on it li { scroll-snap-align: center; } That's it! Pretty cool demo to put together and see how to do this stuff with these APIs 🤓 A lot of cool little tricks to pick up for writing your CSS! ⭐️ CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

232,131 görüntüleme • 2 yıl önce

CSS Trick! ⚡️ You can use scroll-driven animation with background-attachment to create a dynamic glowing card scroller without JS 🔥 section { animation:vibe; animation-timeline:--list; } @​keyframes vibe { to{--hue:320;}} .glow {background: hsl(var(--hue) 80% 50%);} Here's how! 🤙 You can use the background-attachment trick used in other glow card demos 😎 article { background-attachment: fixed; } The difference here is that you aren't going to update the fixed background position with your pointer this time. It can remain fixed. The magic part is that as you scroll, the background will leave the card that's leaving and enter the card that's entering ✨ For the extra background glow, you can use a fixed pseudo element on the list container itself 💪 Once that's in place, you're only task is to change the color of the background as you scroll 🤔 Create a custom property declaration for the --hue @​property --base { inherits: true; syntax: ' '; initial-value: 0; } Then create an animation that updates this value @​keyframes accent { to { --hue: 320; }} The last piece is hooking it up to scroll and there is a little trick in here 👀 First, you need an inline scroll-timeline on the list ul { scroll-timeline: --list inline; } Then you can use timeline-scope to hoist that scroll-timeline up so a parent can use it. You then animate the custom property on this element and let the value cascade down to the places that need it 🔥 section { timeline-scope: --list; animation: accent both linear; animation-timeline: --list; } For example, the glow uses the --hue this way [data-glow] { background-image: radial-gradient( 150px 150px at 50% 50%, hsl(var(--hue) 100% 70% / 0.25), transparent ); } Lastly, scroll-snap is optional of course but plays nice with the scroll-driven animation demos ✨ The key for that is ul { scroll-snap-type: x mandatory; } li { scroll-snap-align: center; } That's it! Pretty fun trick to play with! 🤓 Any questions, let me know! Should we add it to the video walkthrough list? CodePen.IO link below! 👇

jhey ʕ•ᴥ•ʔ

116,458 görüntüleme • 2 yıl önce