Fade elements in and out on scroll in a window with CSS? ✅
@jh3yy146K followers
222,957 views
10 Comments
Comments from the original post on X (Twitter)

@mykytabatrak
@adamwathan So cool! I was going through @bramus scroll-driven demos and had keyframe ranges but I couldn't understand how to account for the padding. Turns out scroll-padding is the solution 🤯, you are a genius!
6 likes

@jh3yy
@adamwathan @bramus Yeah, looks like that will do it 🤙 As mentioned, it was late for me last night 😅 Knew there was a cleaner way but mind was blanking haha Glad we got there in the end! I'll do some write ups on all these things soon 🔜
3 likes

@matiasbaldanza
@adamwathan This is so much better than what I used to do: :before and :after div with a gradient from transparent to background, absolutely positioned over the edges of the carousel.
3 likes

@joshua_soileau
@adamwathan Now do it with Tailwind!
2 likes

@leblancmeneses
@adamwathan I didn't think it was possible without js. awesome work with so little code.
2 likes

@KelvinDimson
@adamwathan This mf!!!!!
1 like

@_vick_thor
@adamwathan Can you please drop codepen link 😩😩😩😩
1 like

@toddmorey
@adamwathan Unfortunately not yet supported on FF / Safari just yet. But still works as progressive enhancement!
1 like

@JanuarioPinto_
@adamwathan Stuff like this would be good for the course 💯 I think it would probably be a good idea to include the tailwind version of animations too, as tailwind is obviously pretty famous (and very handy in react/next), I think that practically speaking, a lot would benefit from it.
1 like

@jh3yy
@adamwathan the amount of overhead to recreate everything I build in Tailwind too is not something I'm overly into if I'm honest
2 likes