答案 0 :(得分:0)
您可以更改来源。
<script type="text/javascript">
$(document).ready(function(){
$(window).scroll(function(){
var lastID = $('.load-more').attr('lastID');
//Try modifying here
if(((window.innerHeight + window.scrollY) >= document.body.offsetHeight) && (lastID != 0)){
$.ajax({
type:'POST',
url:'<?php echo base_url('berita/load_more'); ?>',
data:'id='+lastID,
beforeSend:function(){
$('.load-more').show();
},
success:function(html){
$('.load-more').remove();
$('#postList').append(html);
}
});
}
});
});
</script>
答案 1 :(得分:0)
使用此代码重试
function scrollEvt(){
var lastID = $('.load-more').attr('lastID');
if(((window.innerHeight + window.scrollY) >= document.body.offsetHeight) && (lastID != 0)){
$(window).off('scroll');
$.ajax({
type:'POST',
url:'https://tabungamal.id/berita/load_more',
data:'id='+lastID,
beforeSend:function(){
$('.load-more').show();
},
success:function(html){
$('.load-more').remove();
$('#postList').append(html);
$(window).scroll(scrollEvt);
}
});
}
}
$(document).ready(function(){
$(window).scroll(scrollEvt);
});