Navigation überspringen
Future CSS && UI Tip! ⚡️
0:00 / 0:38

Future CSS && UI Tip! ⚡️

jhey ʕ•ᴥ•ʔ

@jh3yy146.609 Follower

Auf X besuchen
1.093 LikesHerunterladenOriginalbeitrag

230.229 Aufrufe

Future CSS && UI Tip! ⚡️ You could use View Transitions to create those word carousel-type effects 😍 span:nth-of-type(2) { view-transition-name: swap; } ::view-transition-old(swap) { animation-name: slide-down; } ::view-transition-new(swap) { animation-name: slide-up; } How To 1. Create a paragraph split into spans 2. Set an interval in JavaScript that swaps out the accent word 3. Set a view-transition-name on the accent word and the last span Then you've got a responsive word carousel with View Transitions 🤙 Words and inspiration from work louder®'s home page. Had to see if this API could do it and it ended up raising a bug for the web platform! 💪 CodePen.IO link below! 👇

9 Kommentare

Kommentare aus dem Originalbeitrag auf X (Twitter)

  • Profilbild von jhey ▲🐻🎈

    @jh3yy

    Here's that @CodePen link! 🚀 Remember. This will only work in Chromium at the moment 🤓

    31 Likes

  • Profilbild von jhey ▲🐻🎈

    @jh3yy

    And here's the @ChromiumDev issue that got raised from making this demo 🤙 (Fix rolling out into Chrome) Another example of why making random demos can help the <web platform/> 💯 Make things. Raise bugs. Share stuff! 🤓

    18 Likes

  • Profilbild von Terry

    @teddyrised

    Safari be like

    3 Likes

  • Profilbild von Matt

    @uixmat

    Just made exactly this, this afternoon 🔥

    1 Like

  • Profilbild von Abd Mcs

    @muhaimincs

    This is nice. I used to do this in js. I’m always inclined to css solution before get to javascript. Bookmarked

    1 Like

  • Profilbild von Luke Haines

    @LukeGainzz

    It doesn't render properly on my version of Chrome. When it slides in, all of the words are too small, and then after a delay they size back up to the correct height!

    1 Like

  • Profilbild von jhey ▲🐻🎈

    @jh3yy

    Yep – I'm not sure it's quite rolled out to everyone on Chrome yet. It should work as expected in Canary. Look out for that Chrome update 🤙

    1 Like

  • Profilbild von Ronak Bokaria

    @ronak_bokaria

    amazing 👏

    1 Like

  • Profilbild von Mainro Code

    @Mainro_Code

    @SaveToNotion