跳过导航
CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those…
0:00 / 0:30

CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those…

jhey ʕ•ᴥ•ʔ

@jh3yy15万 位关注者

在 X 上查看
424 个赞下载原帖

111,499 次观看

CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those sliding image components 👀 CSS only, JavaScript to enhance later 🤓 Put an image in each panel and make them position: absolute. They can use a container query unit for their size 🫶 img { position: absolute; width: 100cqi; // Make them the container width 🤙 } .panel:last-of-type img { right: 0; } The rest of the trick from last week was using display:grid with grid-template-columns. Then we have a resizable element inside the first column 😎 .panels{ display: grid; grid-template-columns: auto 1fr; 👈 } .resizer{ max-width: 100cqi; overflow: hidden; resize: horizontal; 👈 } Where does JavaScript come in? To progressively enhance the thing with keyboard controls ✨ Not 100% sure of the pattern for that though. Feels like it should be a button that you can toggle into resize mode and then use left/right to resize 🤔 Anyways, CodePen.IO link below! 👇

8 条评论

评论来自 X (Twitter) 上的原帖

  • jhey ▲🐻🎈 的头像

    @jh3yy

    Here's that @CodePen link! 🚀 To be honest, it's jus' messin' with the concept from last week for an article 😁 The design could totally be improved for sure 💯 Would love your input on that! 📢

    16 个赞

  • wés 的头像

    @wesleycoder

    It just came up in my mind that a <progress /> should fit in there somehow to help with the js enhancement. But the more I think about it the more it seems too convoluted. Maybe someone can improve the idea or just tell me how wrong I am.

    1 个赞

  • jhey ▲🐻🎈 的头像

    @jh3yy

    Ha 😅 It's a tricky one for sure. Same goes for the Drag and Drop API which is where my thinking takes me. To make that API a11y friendly, you can use space to toggle into the drag mode and then use arrow keys if I recall. The same could be done here with a tabbable button that's visually hidden 🤔

    2 个赞

  • JEM 的头像

    @Jacksonmills

    Wowowowowow saving this for later

  • Christo 的头像

    @chroxify

    sweet! 👏

  • Arpit Adlakha 的头像

    @arpit20adlakha

    Amazing 🤩

  • Arghya Das 的头像

    @itsarghyadas

    Should I try that in tailwindcss?🤔we will need custom CSS but I can try.

  • 高冷小姨 的头像

    @barton68453

    @rayc2045 The Garden awaits... The fight is comin'. Let's make your Banner cooler @rayc2045 🎯 Simple type: @MokugyoAI Banner Azuki ID Prompt Ex: @MokugyoAI Banner Azuki 1234 Shanghai Let's connect together!!! IKUZO ⛩️