4 ms·
The relevant few lines are these: if ("IntersectionObserver" in window) { const observer = new IntersectionObserver(entries => { entrie
by harrisi 4y ago
The relevant few lines are these:
if ("IntersectionObserver" in window) {
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => { entry.target.drawer.set_visible(entry.isIntersecting); })
}, { rootMargin: "300px" })
all_containers.forEach(container => observer.observe(container));
} else {
all_containers.forEach(container => container.drawer.set_visible(true));
}
You can read more about it here: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API https://developer.mozilla.org/en-US/docs/Web/API/Intersectio...
As a side note, all of the code is very pleasant to read. It's interesting that it's seemingly (almost) all hand-written, given that there are commented-out rules in the CSS, for example. I'm not sure what's going on with the HTML though, probably some custom generator.
- pigcat 4y agoThanks!