GoogleChrome / GoogleChrome/samples

intersectionObserver sample code issue

Open
#746 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
2.4k
Avg merge
24m
Merged PRs (30d)
2

Description

https://googlechrome.github.io/samples/intersectionobserver/
I have found that the line 'if (entries.some(entry => entry.intersectionRatio > 0)) {' can cause some issues.
The issue is that it is possible to get entry.intersectionRatio to be equal to 0 (zero), so it would fail and not add extra content.
I have changed the comparison to entry.intersectionRatio >= 0 , That seems to be okay. The intersectionRatio even if zero is having the target element appear/disappear from the root element (by what I've read, even 1px causes the intersection).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.