我在Facebook页面标签页面上滚动加载数据。它适用于包括IE在内的所有浏览器。但是在Chrome中它不起作用。
我在滚动
上加载数据的代码$(window).scroll(function() { //detect page scroll
if($(window).scrollTop() + $(window).height() >= $(document).height()) //user scrolled to bottom of the page?
{
$.get($('#cmn_scroll_path').val(),{'index': index1,'size':size,'search':search}, function(data){
$(".scroll-data").append(data); //append received data into the element
scroll_flag = true;
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
$('.loading_image').hide();
//alert(thrownError); //alert with HTTP error
});
}
});
它不会进入Windows Chrome中的$(window).scroll(function()
。知道如何解决这个问题吗?
答案 0 :(得分:0)
我更改了窗口以记录它的工作原理:
$(document).scroll(function() { //detect page scroll
if($(document).scrollTop() + $(document).height() >= $(document).height()) //user scrolled to bottom of the page?
{
$.get($('#cmn_scroll_path').val(),{'index': index1,'size':size,'search':search}, function(data){
$(".scroll-data").append(data); //append received data into the element
scroll_flag = true;
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
$('.loading_image').hide();
//alert(thrownError); //alert with HTTP error
});
}