php瀑布流

來源:互聯網
上載者:User

標籤:php

<script>

var finish = 1;
var page = 0;
$(function(){
    $(window).scroll(function(){
        var sTop = $(document).scrollTop();
        var winH = $(window).height();
        var pageH = $(document).height();
        if((sTop >= pageH-winH) && finish== 1){
            waterList();
        }
    })
})

function waterList(){
    finish = 2;
    var nowpage = "{$nowpage}";
    var c = ‘{$c}‘;
    var _type = ‘{$_type}‘;
    var tag_id = ‘{$tag_id}‘;
    $.ajax({
        type:‘get‘,
        url:app+‘/s-boxwater‘,
        data:{page:++page,nowpage:nowpage,c:c,_type:_type,tag_id:tag_id},
        dataType:‘json‘,
        beforeSend:function(){
            var loading = ‘<div style="text-align:center;margin-top: 40px;position: relative;width: 824px;" id="loading-zj"><img src="‘+STATIC+‘/Static/icage/img/ajax-loader.gif" /></div>‘;
            $(‘#boxwater‘).append(loading);
        },
        success:function(r){
            $(‘#loading-zj‘).remove();
            if(r.status == 2){
                $(‘#listpage‘).show();
                finish = 2;
            }else if(r.status == 3){
                $(‘#boxwater‘).append(r.html);
                $(‘#listpage‘).show();
                finish = 2;
            }else if(r.status == 1){
                $(‘#boxwater‘).append(r.html);
                finish = 1;
            }else{
                $(‘#listpage‘).show();
                finish = 2;
            }
        }
    });
}

</script>

<php

    /**
     * box查詢列表     首次載入
     */
    private function boxList(){
        $data = $this->maplist();
        $map = $data[‘map‘];
        $map[‘is_del‘] = 0;
        $_order = $data[‘_order‘];
        $count = model(‘Showbox‘)->where($map)->count();
        import(‘ORG.Util.Page‘);
        $page = new Page($count,48);
        $this->assign(‘listpage‘,$page->show());
        $this->assign(‘nowpage‘,$page->firstRow);
        $list  = model(‘Showbox‘)->where($map)->limit($page->firstRow.‘,12‘)->order($_order)->select();
        foreach ($list as $k=>$v){
            $list[$k][‘user_info‘] = getUserInfo($v[‘uid‘]);
            $list[$k][‘sid‘] = getFirstid($v[‘id‘]);
        }
        $this->assign(‘list‘,$list);
    }


     /**
      * box列表滾動顯示。   //滾動顯示
      */
     public function boxwater(){
        $this->supportList(‘showbox‘);
        $this->subscripList(‘showbox‘);
        $supportList = array();
        $var[‘login_uid‘] = $this->uid;
        if($this->uid){
            $supportList = getSupport($this->uid,‘showbox‘);
        }
        $var[‘supportList‘] = $supportList;
        $subscripList = array();
        if($this->uid){
            $subscripList = getSubscrip($this->uid,‘showbox‘);
        }
        $var[‘subscripList‘] = $subscripList;
         $data = $this->maplist();
         $map = $data[‘map‘];
        $map[‘is_del‘] = 0;
         $_order = $data[‘_order‘];
         $st_page = $_GET[‘page‘];
         $nowpage = $_GET[‘nowpage‘];
         $page = $nowpage+$st_page*12;
        $c = $_GET[‘c‘];
        $list = model(‘Showbox‘)->where($map)->order($_order)->limit($page.‘,12‘)->select();
         if(!empty($list)){
             $html = ‘‘;
             foreach ($list as $k=>$v){
                 $list[$k][‘user_info‘] = getUserInfo($v[‘uid‘]);
                $list[$k][‘sid‘] = getFirstid($v[‘id‘]);
             }
             $var[‘list‘] = $list;
             
             $return[‘status‘] = 1;
             if($st_page == 3){
                 $return[‘status‘] = 3;
             }
            $return[‘html‘] = $this->fetchTpl(‘boxwater‘,$var);
         }else{
             $return[‘status‘] = 2;
         }
         exit(json_encode($return));exit;
         
     }

?php>


此代碼有許多源碼的資料,參數,望測試

php瀑布流

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.