←back to thread

Overengineered Anchor Links

(thirty-five.com)
392 points matser | 1 comments | | HN request time: 0.25s | source
Show context
awayto ◴[] No.43571043[source]
I dabbled with this kind of issue in my docs and ended up using JavaScript's Intersection Observer [0]. It's not a perfect solution [1], but I think it worked well enough [2]. It just identifies when the element comes on screen and then marks it as active however you please. I do appreciate the depth the article went into though!

[0] https://developer.mozilla.org/en-US/docs/Web/API/Intersectio... [1] https://github.com/keybittech/awayto-v3/blob/main/landing/la... [2] https://awayto.dev/docs/0.3.0/

replies(2): >>43571808 #>>43586223 #
1. ruduhudi ◴[] No.43571808[source]
This is by far the best solution. Super simple and covers all those issues.