Hacker News new | past | comments | ask | show | jobs | submit login

Could someone explain what `index.js`[1] is doing? It looks like code to figure out whether someone is actually reading the article or not but I'm curious why the various timeouts and scroll listeners, and what they're doing exactly.

[1] https://github.com/ncase/ballot/blob/gh-pages/js/index.js




That's exactly what it's doing -- it's trying to figure out if your viewport is looking at the content 'above the fold', so that it can show the "splash iframe" [1] while you're looking at it, and stop JS-animating it when you're not.

[1] http://ncase.me/ballot/splash/splash.html




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

Search: