Last active
November 5, 2019 19:14
-
-
Save kgriffs/3de5b2ba94a79229a5f21d9f1342f243 to your computer and use it in GitHub Desktop.
Scroll to bottom of page using vanilla JS to trigger lazy loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scrollingElement = document.scrollingElement | |
const viewport_height = scrollingElement.clientHeight | |
for (let pos = 0; pos < scrollingElement.scrollHeight; pos += viewport_height) { | |
scrollBy(0, viewport_height) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To go back to the top: