Get scroll direction from IntersectionObserverEntry #28197
Labels
area: Resize/Intersection Observer
Content:WebAPI
Web API docs
help wanted
If you know something about this topic, we would love your help!
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
What specific section or headline is this issue about?
Intersection change callbacks
What information was incorrect, unhelpful, or incomplete?
That section says:
I don't believe "and the direction in which the transition occurred" is true. There's no explicit field that describes direction. I wish there was - that's what I came looking for - but I don't think that exists.
What did you expect to see?
I was hoping to find an example of getting the scroll direction from an
IntersectionObserverEntry
, but I don't believe there is an explicit field for that (despite the docs sort of alluding to it).It would be nice if MDN included an example of how to do it. From what I've researched, it's possible by checking
entry.boundingClientRect.<top|bottom|left|right> < 0
andentry.isIntersecting
, but I don't yet have a clean reliable code to share.Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/api/intersection_observer_api
The text was updated successfully, but these errors were encountered: