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

    //判断页面滚动到顶部和底部
    $(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("到底啦啦");
        }
    });

 

posted @ 2015-11-17 17:43  知兮  阅读(3439)  评论(0编辑  收藏  举报