w3c/IntersectionObserver

[QUESTION HELP]How to work with multiple different HTML elements

Closed this issue · 2 comments

I know I'm mistaken by asking a question here, but stackoverflow's limiting my question token. I've asked on forums but not getting answered yet

I have 2 different html elements to be intersected with.

Expected result:
if #infinite is intersected, console.log('a'). if #infinite2 is intersected, console.log('b')
how do I deal with this?

runnable example:
https://codepen.io/dhika345/full/zVxQWP

If I'm understanding your question right you would likely want both elements to be observed by the same observer and then test the target property in the IntersectionObserverEntry passed into the callback.

this has been solved. thanks anyway