samples icon indicating copy to clipboard operation
samples copied to clipboard

intersectionObserver sample code issue

Open joekingTheThird3 opened this issue 4 years ago • 0 comments

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).

joekingTheThird3 avatar Oct 28 '21 11:10 joekingTheThird3