79670446

Date: 2025-06-18 10:30:16
Score: 1.5
Natty:
Report link

I created a package for this, called rect-observer.

Internally, it creates an intersection observer with margins calculated to include only the target rect. it also uses two resize observers to deal with cases where the object or margins become invalid.

I preferred this solution to position observer presented in other answer since it works with less intersection observers and works even when the target is not in the scroll visible area.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Yolisses