3 ms·
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 t
by YPCrumble 10y ago
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 https://github.com/ncase/ballot/blob/gh-pages/js/index.js
- niftich 10y agoThat'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 http://ncase.me/ballot/splash/splash.html