Skip to content

Instantly share code, notes, and snippets.

@ScottPolhemus
Created April 20, 2017 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScottPolhemus/d0ebb5c8bafc63f2bd96ec30a6800396 to your computer and use it in GitHub Desktop.
Save ScottPolhemus/d0ebb5c8bafc63f2bd96ec30a6800396 to your computer and use it in GitHub Desktop.
Continually scroll to the bottom of a page
var scrolling
function scrollToBottom() {
if (scrolling)
requestAnimationFrame(scrollToBottom)
window.scrollTo(0, document.body.offsetHeight)
}
function startScrolling() {
scrolling = true
scrollToBottom()
}
function stopScrolling() {
scrolling = false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment