Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get scroll direction from IntersectionObserverEntry #28197

Closed
jfbrennan opened this issue Jul 26, 2023 · 0 comments · Fixed by #35687
Closed

Get scroll direction from IntersectionObserverEntry #28197

jfbrennan opened this issue Jul 26, 2023 · 0 comments · Fixed by #35687
Labels
area: Resize/Intersection Observer Content:WebAPI Web API docs help wanted If you know something about this topic, we would love your help!

Comments

@jfbrennan
Copy link
Contributor

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:

Each entry in the list of thresholds is an IntersectionObserverEntry object describing one threshold that was crossed; that is, each entry describes how much of a given element is intersecting with the root element, whether or not the element is considered to be intersecting or not, and the direction in which the transition occurred.

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 and entry.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
@jfbrennan jfbrennan added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jul 26, 2023
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jul 26, 2023
@sideshowbarker sideshowbarker added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Resize/Intersection Observer Content:WebAPI Web API docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants