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 = '
';
$('#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;
}
}
});
}
/**
* 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>
此代码有许多源码的数据,参数,望测试