我找到了這段代碼。當您滾動到整個頁面的底部時它會起作用。 我想改變這段代碼來檢測div的底部。jquery:當滾動到div的底部時使代碼工作
這是代碼
$(window).data('ajaxready', true).scroll(function(){
if ($(window).data('ajaxready') == false) return;
if($(window).scrollTop() == $(document).height() - $(window).height())
{
var datastring=$(".passform").last().serialize();
$('div#loadmoreajaxloader').show();
$(window).data('ajaxready', false);
$.ajax({
type: "POST",
url: "post_update.php",
data: datastring,
cache : false,
success: function(html)
{
if(html)
{
$("#update").append(html);
$('div#loadmoreajaxloader').hide();
}else
{
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
}
$(window).data('ajaxready', true);
}
});
}});
謝謝!