1

我正在使用 jQuery wookmark 并且还使用 ajax 滚动加载更多分页问题是,当我使用简单的布局并测试我的脚本时,当我将它与 jQuery wookmark 一起使用时,它一切正常,然后滚动系统有时无法正常工作它的重复数据。

这些是我的脚本:

    $(document).ready(function(){   
        function last_msg_funtion()
        {
           var IDall=$(".box-main:last").attr("zid");
           var cbid=$(".box-main:last").attr("pid");
            $('div#last_msg_loaderi').html('<img src="bigLoader.gif">');
             $.get('page.php', {'action':'get','last_msg_id':IDall,'id':cbid}, 
            function(dataz){
                if (dataz != "") {
                $(".box-main:last").after(dataz);           
                }
                $('div#last_msg_loaderi').empty();
            });
        };  
        $(window).scroll(function(){
            if  ($(window).scrollTop() == $(document).height() - $(window).height()){
               last_msg_funtion();
            }
        }); 

});

这是第一个 load.php

        "select box.upload_type,
    box.id,
    box.box_type,
    box.page_name,
    box.title,
    box.connect,
    box.type,
    box.uid,
    box.description,
    box.image,
    box.url,
    box.status,
    box.date,
    box.time
        from boxes as box left join page_boxes as pbox on 
    box.id=pbox.bid
     where pbox.page_id='".$_GET['id']."'
     and box.status='".$approval."'
     order by box.id 
    desc limit 100"
while($my_boxi=mysql_fetch_array($myboxexi)){
$bid=$my_boxi['id'];
<div class="box-main" zid="<?php echo $bid; ?>" pid="<?php echo $_GET['id']; ?>">
</div>
}

这是第二次加载 .php

$last_msg_id=$_GET['last_msg_id'];
            "select box.upload_type,
        box.id,
        box.box_type,
        box.page_name,
        box.title,
        box.connect,
        box.type,
        box.uid,
        box.description,
        box.image,
        box.url,
        box.status,
        box.date,
        box.time
            from boxes as box left join page_boxes as pbox on 
        box.id=pbox.bid
         where pbox.page_id='".$_GET['id']."'
         and box.status='".$approval."' and box.id<'".$last_msg_id."'
         order by box.id 
        desc limit 100"
$last_msg_id='';
    while($my_boxi=mysql_fetch_array($myboxexi)){
    $bid=$my_boxi['id'];
    <div class="box-main" zid="<?php echo $bid; ?>" pid="<?php echo $_GET['id']; ?>">
    </div>
    }
4

0 回答 0