JQuery 判断滚动条是否到底部

 1 BottomJumpPage: function () {
 2             var scrollTop = $(this).scrollTop();
 3             var scrollHeight = $(document).height();
 4             var windowHeight = $(this).height();
 5             if (scrollTop + windowHeight == scrollHeight) {  //滚动到底部执行事件
 6                     console.dir("我到底部了");
 7 
 8             }
 9             if (scrollTop == 0) {  //滚动到头部部执行事件
10             console.dir("我到头部了");
11 
12             }
13  }

 

$(window).scroll(BottomJumpPage);

  

posted on 2016-01-13 13:26  爱拼才有钱  阅读(1650)  评论(0编辑  收藏  举报

导航