Ulises Cortés
Ulises Cortés

Reputation: 81

If I pass a NodeListOf<HTMLElement> to the Motion's InView function, is an Intersection Observer created for each Element or is a general one created?

I am working with Motion's InView function to detect different elements within the ViewPort, so I am currently giving it a NodeListOf.

When I do this, it creates a general Intersection Observer, one for each element in my NodeListOf or how does it work?

This is a segment of what I am doing:

export function cardsInView(cards: NodeListOf<HTMLElement>, indexLinks: NodeListOf<HTMLAnchorElement>) {
    inView(cards, (info) => {
    ...

I have this question to know if it is a better idea to pass each element with a forEach or leave it this way.

Upvotes: 0

Views: 15

Answers (0)

Related Questions