javascript scroll auto

Solutions on MaxInterview for javascript scroll auto by the best coders in the world

showing results for - "javascript scroll auto"
Jessica
23 Jun 2017
1// If you don't know when data comes, you can set an interval:
2window.setInterval(function() {
3  var elem = document.getElementById('yourDivWithScrollbar');
4  elem.scrollTop = elem.scrollHeight;
5}, 5000);
6
7// If you do know when data comes, you can do it like the following:
8var elem = document.getElementById('yourDivWithScrollbar');
9elem.scrollTop = elem.scrollHeight;