Skip navigation
Card stack using scroll-driven animation w/ snapping. Just a few lines of JS, zero dependencies.
0:00 / 0:22

Card stack using scroll-driven animation w/ snapping. Just a few lines of JS, zero dependencies.

Paul Noble

@paul__ux1.7K followers

Visit on X
1,298 likesDownloadOriginal post

84,192 views

Card stack using scroll-driven animation w/ snapping. Just a few lines of JS, zero dependencies. Code + demo via CodePen.IO

34 Comments

Comments from the original post on X (Twitter)

  • Pontus Wellgraf's profile picture

    @Wellgraf

    @paul_uiux @CodePen Absolutely amazing! Feels so good 🔥 Just a heads up, it looks like with the touchpad interaction (Swiping wasn't supported), only the first cards gets put behind the stack whereas all other repetitions just scews the stack and hard cut to the next card

    4 likes

  • Paul Noble's profile picture

    @paul__ux

    @CodePen Gotcha! That’s sounds like it’s not updating the active index which requires scroll snap events (Chrome 129+)

    1 like

  • Paul Noble's profile picture

    @paul__ux

    @CodePen Chrome 129’s rolling out now I think so try updating or try on Chrome Beta?

  • Pontus Wellgraf's profile picture

    @Wellgraf

    @paul_uiux @CodePen I see! Just updated but still feels a little strange sometimes - See video for reference It feels like it's every time you don't wait until the transition has finished when the whole stack scews oddly. Maybe the ease out should be shortened and finish earlier to avoid this

  • Paul Noble's profile picture

    @paul__ux

    @CodePen Ah yeah, that’s not right 🤨 The scroll snap change fires only when the animation has completely finished. Not ideal but if you try moving through slowly (and waiting a fraction after the out transition) I think it should all look ok

    1 like

  • Pontus Wellgraf's profile picture

    @Wellgraf

    @paul_uiux @CodePen It does work if I wait! I just felt it was finished but the ease out is very slow in the end. I think if the transition of the cards went behind the stack faster and with less delay, this would solve this and various swipe speeds 🚀

  • Umxr K's profile picture

    @umar_1_8

    @paul_uiux @CodePen Just brilliant art

    2 likes

  • Dennis Landi's profile picture

    @Dennis_A_Landi

    @paul_uiux @CodePen Hi Paul, the codepen isn't working for me. The mouse swipe isn't working and the whole thing is stationary. Head's up.

    2 likes

  • Paul Noble's profile picture

    @paul__ux

    @CodePen Hey! Can you try touch pad swipe?

  • Dennis Landi's profile picture

    @Dennis_A_Landi

    @paul_uiux @CodePen Hi. Yeah, it does work with the touchpad and the middle button pressed on my PC laptop. And it works on my phone. But...Can you getting working with a normal mouse?

    1 like

  • Paul Noble's profile picture

    @paul__ux

    @CodePen We can bind mouse drag *but* when the mouse is released it’ll snap immediately (no smoothing animation to the closest snap point)

  • David K 🎹's profile picture

    @DavidKPiano

    @paul_uiux @CodePen This is incredible!

    2 likes

  • Robera Geleta's profile picture

    @RoberaGeleta

    @paul_uiux @CodePen Glad to see this memed

    2 likes

  • mirko_ddd ⁝'s profile picture

    @Mirko_ddd

    @paul_uiux @CodePen The tilt on Y axes makes the difference, feels so real. Congratulations 👏

    2 likes

  • James Vreeken's profile picture

    @mastermindesign

    @paul_uiux @CodePen not as cool as yours but works with without scroll snap. you are an inspiration!

    2 likes

  • Gustav Ekerot's profile picture

    @designgurra

    @paul_uiux @CodePen Impressive! I've tried doing something similar before so I know how much effort it takes, good job!

    1 like

  • _Tush_'s profile picture

    @The_Tushh

    @paul_uiux @CodePen Cool !

    1 like

  • Hussain Khan's profile picture

    @hnkhandev

    @paul_uiux @CodePen Very nice 👏

    1 like

  • Valerio Leo @ Raycash ☀️'s profile picture

    @valerioHQ

    @paul_uiux @CodePen This is brilliant. Are you planning to make it a npm package?

    1 like

  • Paul Noble's profile picture

    @paul__ux

    @CodePen Thanks! It’s using features that aren’t available in most browsers (Safari doesn’t support scroll driven animation at all, yet) so it probably wouldn’t work as a package. Maybe in a few years?

    1 like