Answers for "window scroll to bottom"

2

js scroll to bottom

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

window.scroll

scroll function

window.scroll({
 top: 0, 
 left: 0, 
 behavior: 'smooth' 
});

window.scroll(x-coord, y-coord)
window.scroll(options)
Posted by: Guest on October-15-2020
4

javascript detect scroll to bottom of page

function getDocHeight() {	// $(document).height() value depends on browser
    var D = document;
    return Math.max(
        D.body.scrollHeight, D.documentElement.scrollHeight,
        D.body.offsetHeight, D.documentElement.offsetHeight,
        D.body.clientHeight, D.documentElement.clientHeight
    );
}
$(window).scroll(function() {
       if($(window).scrollTop() + $(window).height() == getDocHeight()) {
           alert("bottom!");
       }
});
Posted by: Guest on May-22-2021
0

javascript auto scroll on bottom

const scrollToTop = () => {
  const scrollTopButton = document.getElementById('scrollTopButton');

  scrollTopButton.addEventListener('click', () => {
    window.scrollTo(0, document.body.scrollHeight);
  });
};
Posted by: Guest on January-28-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language