Video wird geladen...
Video konnte nicht geladen werden
CSS Tip! 🤯 You can create a CSS-only version of this balance slider using a scroll animation on the underlying input[type=range] 🚀 ::-webkit-slider-thumb { view-timeline: --thumb inline; } Scroll animation driven by the slider thumb animates a number between the "min" and "max" of the range 😅 @property --value... show more
377,435 Aufrufe • vor 2 Jahren •via X (Twitter)
10 Kommentare

Here's that @CodePen link! 🚀 Gonna add the snippet of JavaScript to make this work in all browsers. The only unsupported mechanic here is updating a custom property with scroll animations which is the same as doing it on "input" 🤙

Works in Firefox && Safari now too ☕️ Tiny snippet of JavaScript required for that 🤏 Basically, on "input", update inline custom property value with input value ⭐️

CSS King is here! 👑

This is a lovely design Malay 👏 Couldn't resist. Thank you for the inspiration. Almost wanted to make it "Spirit and Mixer" 😅 Might add that version haha

How accessible is this?

The underlying mechanism is a basic [type=range] and label combination. The updating label is hidden from screenreader. But, perhaps having it read out would make sense 🤔 There is a visually hidden label that reads "Coffee to Milk ratio (%)". And the underlying input will be read as role=slider

You can create a CSS-only version of this balance slider using a scroll animation on the underlying input[type=range] 🚀 ::-webkit-slider-thumb { view-timeline: --thumb inline; } Are this support for all browsers?

Added the 10 or so lines of JavaScript so you could use it anywhere 🤙

no codepen link

The moment I saw that tweet I knew you are going to build it. Guru level!!
