jQuery wookmark如何使用向下滚动加载更多?

时间:2013-11-10 18:08:15

标签: php jquery ajax wookmark

我正在使用jQuery wookmark并且还使用ajax滚动加载更多的分页问题是,当我使用简单的layut并测试我的脚本时,所有工作完美当我使用这个与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();
            }
        }); 

});

这是第1次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>
    }

0 个答案:

没有答案