2012-01-07 3 views
1

私はこのjQueryスクリプトに問題があります:
私がしたいことは、ページの終わりに達したときに機能をトリガーすることです。jQueryを使用してFirefoxでページの最後までスクロールする方法を検出するにはどうすればよいですか?

$(window).scroll(function() { 
    if (document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight) { 
     // Display alert or whatever you want to do when you're 
     // at the bottom of the page. 
     if (autoscroll == 1) { 
      $('#loadMore').trigger('click'); 
     } 
    } 
}); 

しかし、なぜこのコードはFirefoxでは動作しませんか?

答えて

2
$(window).scroll(function() { 
    if ($(document).scrollTop() + $(window).height() >= $("body").height()) 
    { 
     $('#loadMore').trigger('click'); 
    } 
}) 
+0

の間で異なる挙動をwindow.innerHeightの代わり$(window).height()を使用することをお勧めしますことを発見しました...あなたはhttp://www.theworldsmiling.comでそれを見ることができます ChromeとSafariで動作しますが、FFXは動作しません。 –

+0

私はfirefoxでテストしましたが、動作しています。を使用して? ところで、container.tzShutterと呼ばれるものに関連するエラーがいくつかありますが、javascriptコンソールを確認してください。 –

+0

Mac OSの最新バージョンはまだ動作していません... –

0

私は上記の回答に問題がありました。ここでは私のために働いていたバージョンは次のとおりです。

$(window).scroll(function() { 
    if($(document).scrollTop() + $(window).height() >= $(document).height()) { 
    // At the bottom of the frame 
    } 
}); 
0

私はこの方法を試してみましたが、まだ私の問題が解決しないことが原因でChromeとFirefoxの

関連する問題