When using the polyfill my entries always have an intersectionRatio of 1. I've just spend some time debugging it, and after some time I figured the problem is in the following part of _getRootRect()
:
...
// Use <html>/<body> instead of window since scroll bars affect size.
var html = document.documentElement;
var body = document.body;
rootRect = {
top: 0,
left: 0,
right: html.clientWidth || body.clientWidth,
width: html.clientWidth || body.clientWidth,
bottom: html.clientHeight || body.clientHeight,
height: html.clientHeight || body.clientHeight
};
...
It defaults to use document.documentElement.clientHeight which in my case returns the full height of all content, whereas document.body.clientHeight will return the height of the viewport (which I guess is the intention).
Switching to prefer body over documentElement, makes the polyfill work for me. Can anyone ellaborate on why to use documentElement?
MouradouchaneMouradouchane
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4