News for hackers. Stuff that matters.
Re:Show HN: In-view.js – Get notified when DOM elements ente... by johnhenry on Saturday August 27, 2016 @10:38AM (#12372520)
Interesting project. I wonder if you might be willing to outline a few use cases?
Re:Show HN: In-view.js – Get notified when DOM elements ente... by andrewbarba on Saturday August 27, 2016 @10:44AM (#12372547)
One of the best use cases is lazy loading expensive data until the div is visible. Image loading, or even fetching a resource. You essentially get this for free in native apps (iOS/Android with recycled views) but there hasn't been a great way to accomplish this on the web.

Note: this is definitely not the same as a recycled view. But can help accomplish one aspect

Re:Show HN: In-view.js – Get notified when DOM elements ente... by talklittle on Saturday August 27, 2016 @01:16PM (#12373214)
Yes, lazy loading is a good use case.

Echo.js (https://github.com/toddmotto/echo) is another small no-dependency library (1.89 KB minified), which detects elements appearing on screen, and goes a step further to swap the "src" attribute with a placeholder for lazy loading and unloading.

Disclosure: I've submitted a pull request to it.

Re:Show HN: In-view.js – Get notified when DOM elements ente... by tanto on Saturday August 27, 2016 @10:44AM (#12372549)
For example store img src tag in data-src and then set src when image comes into view. So to say lazy loading of images.
Re:Show HN: In-view.js – Get notified when DOM elements ente... by bikamonki on Saturday August 27, 2016 @10:56AM (#12372595)
Fancy animations like fading in/out content when scroll has reached a given element.