Created
January 31, 2019 07:42
-
-
Save earlwlkr/7e19b0b8ed8147f24002eb0f3240e49b to your computer and use it in GitHub Desktop.
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
{ | |
let scrollDiv = document.getElementById('messageViewContainer').children[0]; | |
let lastHeight = 0; | |
window.ss = false; | |
function csr() { | |
if (window.ss) { | |
window.ss = false; | |
return; | |
} | |
let newHeight = scrollDiv.scrollHeight; | |
if (newHeight !== lastHeight) { | |
scrollDiv.scrollTop = 0; | |
lastHeight = newHeight; | |
setTimeout(csr, 150); | |
} else { | |
console.error('stopped auto scroll'); | |
} | |
} | |
csr(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment