【发布时间】:2014-05-27 11:25:30
【问题描述】:
今天我看到我的 Facebook 帐户并滚动底部。一段时间后,我发现它在滚动时加载了更多的 -2 数据(滚动位置与以前相同)。我认为这是 Facebook 提供的新功能。以前,他们首先进入底部并获取该事件,而不是加载数据示例以刷新。我们可以在滚动时加载新数据,以便它在同一页面中查看所有数据吗?
$(document).ready(function(){
$('#fullContainer').on('scroll', function () {
if ($(this).scrollTop() === 0 ) {
// alert('--')
if(file_show_counter>0){
var precontent=$("#preRealTimeContents").html();
//$("#loadingImg").hide();
$("#realTimeContents").html($("#preRealTimeContents").html() + '<div style="clear:both;"></div>');
console.log("preRealTimeContents : " + $("#preRealTimeContents").height());
//$("#preRealTimeContents").html('');
$("#preRealTimeContents").html(pages[--file_show_counter]+ '<div style="clear:both;"></div>');
$("#fullContainer").scrollTop(
$("#preRealTimeContents").height()
);
}
}
else if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight ) { if(++file_show_counter<count) {
//alert(file_show_counter);
$("#preRealTimeContents").html($("#realTimeContents").html());
$("#realTimeContents").html(pages[file_show_counter+1]+'<div style="clear:both;"></div>');
$("#fullContainer").scrollTop(
$("#preRealTimeContents").height()- $("#fullContainer").height()
);
}else {
file_show_counter--;
}
}
});
});
谢谢
【问题讨论】:
-
是否要求开始显示
page_1,不显示page_2-page_5,然后在scoll时显示page_2-page_5?谢谢 -
要求是一次显示两个页面,请检查我的小提琴并检查它..你会得到我想要的想法
-
@guest271314 请检查jsfiddle.net/N5LZB/28/.It 首先显示page_4 和page_5。我需要可见的div 概念。如果用户知道我在preRealTimeContents div 中,它会加载更多数据page_3。现在如果用户有page_3 和page_4 显示。并且滚动底部用户知道他是在 realTimeContents 中加载 page_5 和
标签: javascript jquery facebook