2012-06-14 52 views
0

以下無限滾動腳本在桌面和Android Web瀏覽器上運行良好。 但不適用於iPhone 4. 我應該在哪裏修改adaquate for iphone和Android?無限滾動無法在iphone上工作

「#more」是mysql查詢輸出的div ID。

下面是腳本的一部分

var page = 1; 
$(window).scroll(function() { 
$('#more').hide(); 
$('#no-more').hide(); 

if($(window).scrollTop() + $(window).height() > $(document).height() - 200) { 
    $('#more').css("top","400"); 
    $('#more').show(); 
} 

if($(window).scrollTop() + $(window).height() == $(document).height()) { 

$('#more').hide(); 
$('#no-more').hide(); 

page++; 
+2

這是一個重複的** SO問題** [** HERE **](http://stackoverflow.com/q/10952179/1195891)。 – arttronics

+0

謝謝。我在那個鏈接上找到了一些有用的信息。 –

回答

-2

嘗試更換此:

if($(window).scrollTop() + $(window).height() == $(document).height()) 

通過這樣的:

if($(window).scrollTop() + $(window).height() > $(document).height()) 
0

舊代碼: 舊代碼下面唯一的工作電腦瀏覽器。

if ((($(window).scrollTop()+document.body.clientHeight)==$(window).height()) && isload=='true'){ 

新代碼: 我只是改變==爲> =。它可以在Android(Chrome)和iOS上運行

if ((($(window).scrollTop()+document.body.clientHeight)>=$(window).height()) && isload=='true')