Created
April 20, 2017 16:54
-
-
Save ScottPolhemus/d0ebb5c8bafc63f2bd96ec30a6800396 to your computer and use it in GitHub Desktop.
Continually scroll to the bottom of a page
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
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