Live data from Hacker News

Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

github.com

1–10 of 69 posts

Re: Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

#2
I hope this gets used for good, not evil. Lots of sites (you know, those sites, they crop on on HN from time to time) flash up "give me your email address so I can send you spam" boxes before I can read the blog post. Or when it thinks I've gone somewhere else when in fact I just opened it in a new tab. Or if a momentarily switched away. I mostly close blogs that aggressively try to sell me things, but sometimes I want to read the content.

Conversations about what's an app and what's a document aside, I'd much rather documents didn't know anything about how they were being displayed.

Re: Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

#3
Babel and webpack are megaoverkill for this and account for a good chunk of the 2k gzipped size. The actual library code is barely 140SLOC. There's a lot of room for improvement if this is intended to be a real standalone library (vs. a webpack/babel test).

Re: Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

#4
post #3

Babel and webpack are megaoverkill for this and account for a good chunk of the 2k gzipped size. The actual library code is barely 140SLOC. There's a lot of room for improvement if this is intended to be a real standalone library (vs. a webpack/babel test).

I've found rollup, https://rollupjs.org/, to be really useful for this.

Re: Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

#6
post #2

I hope this gets used for good, not evil. Lots of sites (you know, those sites, they crop on on HN from time to time) flash up "give me your email address so I can send you spam" boxes before I can read the blog post. Or when it thinks I've gone somewhere else when in fact I just opened it in a new tab. Or if a momentarily switched away. I mostly close blogs that aggressively try to sell me things, but sometimes I wa…

It's unfortunate. However, it's been shown over and over to have the best conversion rate for getting people's emails, so it's a trend that's only going to become more popular from here (until the next high conversion pattern is developed).

Re: Show HN: In-view.js – Get notified when DOM elements enter or exit the viewport

#9

Interesting project. I wonder if you might be willing to outline a few use cases?

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

Post reply on HN