 <p>This immmediate thing that jumps out at me: this is wrong:</p> <pre><code>if (section._isInViewport) { </code></pre> <p><code>_isInViewport</code> requires you to pass the element in as an argument, like so:</p> <pre><code>if (_isInViewport(section)) { </code></pre> <p>You also don't need to check the event type in the event handler. Since you're only calling that on scroll, you already know the event type is a scroll event. Instead of thing:</p> <pre><code>if (event.type === 'scroll') { _getSections(); } </code></pre> <p>You want this:</p> <pre><code>_getSections(); </code></pre>