检测iphone底部的滚动

时间:2012-06-26 06:50:48

标签: javascript jquery

我想检测一下我是否在页面底部。这适用于任何浏览器 - 但不适用于iPhone。

if ($(window).scrollTop() == ($(document).height() - $(window).height())){
alert('on bottom'); 
}

我做错了什么?

1 个答案:

答案 0 :(得分:0)

请改为尝试:

$(window).scroll(function () { 
   if($(window).scrollTop() + $(window).height() >= $(document).height()){
       alert('on bottom'); 
   }
});
相关问题