Thanks for the advice!
I managed to solve it (although it’s still a bit buggy at times) using the Intersection Observer API combined with parts of the original Phoenix hook.
I’ve shared the hook as a GitHub Gist in case anyone else finds it useful.
If you have any suggestions for improvements, I’d love to hear them!






















