Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

CSS-only magnetic link effect 🤯 li:has(a:is(:hover, :focus-visible)) {anchor-name: --a; } ul::before { left: anchor(--a left); width: anchor-size(--a width); } using CSS anchor positioning, declare an anchor on hover for the indicator 🚀

234,262 Aufrufe • vor 1 Jahr •via X (Twitter)

9 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

here's the @CodePen for this one works in all browsers ✅ where anchoring isn't supported, use :has() with some custom properties on :hover/:focus-visible instead of getting the bounding client rect on every hover, etc. ✅

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

"bUT gpT CaN dO iT if I ASk iT" the issue is, you didn't know what to ask it and it didn't know how to come up with an efficient solution (kinda fed up with some of the reply guys on this platform. you jus get muted or blocked now. don't owe you a thing)

Profilbild von Nicholas Arce
Nicholas Arcevor 1 Jahr

You make me feel like I know nothing about CSS. I love it.

Profilbild von Mathew Dony
Mathew Donyvor 1 Jahr

Don't give us the code, someone might accidentally use it

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

👏🏆

Profilbild von Fred Wanders
Fred Wandersvor 1 Jahr

Sorry maybe i m missing something. Where is the magnetic effect

Profilbild von Simon
Simonvor 1 Jahr

Its great for tooltips, custom menu dropdowns and select dropdowns when mixed with the popover api 👌🔥

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

yep, it's capable of a lot more too though done a lot of demos and talks around these APIs, they were my job at one point 🚀 (my name is on the spec 😉)

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 1 Jahr

for this purpose, it's literally a handful of JavaScript lines to polyfill

Ähnliche Videos