2012-06-26 68 views
-1

我想檢測我是否處於頁面底部。這適用於任何瀏覽器 - 但不適用於iPhone。檢測iPhone上底部的滾動條

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

我做錯了什麼?

回答

0

試試這個:

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

不起作用:/ –

+0

我editted我的答案,現在就來試試。 –

+0

不...現在沒有戒備:/它真的很棘手... –