Detect when Scroll reaches the BOTTOM of the page [ without jQuery ]

前端 未结 5 813
终归单人心
终归单人心 2020-12-14 03:20

I want to alert something when the scroll reaches the BOTTOM of the page, like this:

$(function(){
  $(document).scroll(function() {
    if($(document).scrol         


        
5条回答
  •  情深已故
    2020-12-14 03:54

    document.onscroll = function() {
        if(!document.body.scrollTop){
            alert('top');
        }
    }
    

    JSFiddle demo

提交回复
热议问题