On scroll to bottom and wait

by Ryan Perez

JavaScript

function scroll1() {
    window.scrollTo(0, document.body.scrollHeight);
    if (document.body.scrollHeight === window.scrollY) {
        alert('bottom');
    } else {
        setTimeout(scroll, 10000);
    }
}

function disableScroll() {
    // Get the current page scroll position
    scrollTop = window.pageYOffset || document.documentElement.scrollTop;
    scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
  
        // if any scroll is attempted, set this to the previous value
        window.onscroll = function() {
            window.scrollTo(scrollLeft, scrollTop);
        };
}
  
function enableScroll() {
    window.onscroll = function() {};
}
undefined
disableScroll()