Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: