Alert using Jquery when Scroll to end of Page

后端 未结 6 1785
余生分开走
余生分开走 2020-12-31 15:43

Is there a way to find out page end using Jquery, so that a simple message can be displayed saying you have reached end of the page.

6条回答
  •  清歌不尽
    2020-12-31 15:47

    This will work and I tested it in IE 7,8,9 , FF 3.6, Chrome 6 and Opera 10.6

    $(window).scroll(function()
    {
        if (document.body.scrollHeight - $(this).scrollTop()  <= $(this).height())
        {
            alert('end');
        }
    });
    

提交回复
热议问题