[jquery]判断页面滚动到顶部和底部(适用于手机web加载)

时间:2023-12-06 15:21:38
    //判断页面滚动到顶部和底部
$(window).scroll(function(){
var doc_height = $(document).height();
var scroll_top = $(document).scrollTop();
var window_height = $(window).height(); if(scroll_top == 0){
alert("到顶啦");
}else if(scroll_top + window_height >= doc_height){
alert("到底啦啦");
}
});