Answers for "js to scroll down to bottom"

8

js scroll to bottom

window.scrollTo(0,document.body.scrollHeight);
Posted by: Guest on July-13-2020
0

javascript scroll to bottom

function gotoBottom(id){
   var element = document.getElementById(id);
   element.scrollTop = element.scrollHeight - element.clientHeight;
}
Posted by: Guest on March-03-2022
1

js scroll to bottom

var notChangedStepsCount = 0;
var scrollInterval = setInterval(function() {
    var element = document.querySelector(".element-selector");
    if (element) { 
        // element found
        clearInterval(scrollInterval);
        element.scrollIntoView();
    } else if((document.documentElement.scrollTop + window.innerHeight) != document.documentElement.scrollHeight) { 
        // no element -> scrolling
        notChangedStepsCount = 0;
        document.documentElement.scrollTop = document.documentElement.scrollHeight;
    } else if (notChangedStepsCount > 20) { 
        // no more space to scroll
        clearInterval(scrollInterval);
    } else {
        // waiting for possible extension (autoload) of the page
        notChangedStepsCount++;
    }
}, 50);
Posted by: Guest on November-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language