s

javascript check if user has scrolled to the botton of the page edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 29 January 2021 | 1703

display a console message "reached bottom" when the user has the window to the bottom of the page. please find the code below.

Javascript Code

$(window).scroll(function () {
        if ($(window).scrollTop()   $(window).height() > $(document).height() - 100) {
            console.log("reached bottom");
        }
    });