我想使用这个脚本创建多个无限页面 - 但是我似乎只能创建两个页面。谁能告诉我我做错了什么?
var counter = 0;
$(window).scroll(function() {
if ($(window).scrollTop() == $(document).height() - $(window).height() && counter < 4) {
appendData();
}
});
function appendData() {
var html = '';
for (i = 0; i < 1; i++) {
html += '';
}
if (counter < 1)
$('#myScroll').append('<? include_once 'GNC-10';?>');
counter++;
if (counter == 3)
$('#myScroll').append('<? include_once 'GNC-2';?>');
counter++;
}
&#13;
答案 0 :(得分:0)
var counter=0;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height() && counter < 4) {
appendData();
}
});
function appendData() {
var html = '';
for (i = 0; i < 1; i++) {
html += '';
}
if(counter < 1)
$('#myScroll').append('<? include_once 'GNC-10.php';?>');
counter++;
if(counter > 2)
$('#myScroll').append('<? include_once 'GNC-1.php';?>');
counter++;
if(counter == 3)
$('#myScroll').append('<? include_once 'GNC-2';?>');
counter++;
}