$(window).scroll(function () { //执行监视滚动条事件
if ($(window).scrollTop() >=$(document).height() - $(window).height()) { //判断滚动是否到达底部
$("#ajaxlogin").show();
var num = $("#num").attr("num");//获取当前数量
var num1 = parseInt(num)+6;//获取获取当页最高数
$("#num").attr("num",num1)//把最高数赋值给#num
$.post("{PURL('video/videoajax')}",{ "num":num},function(data){
var data=eval(data);
//console.log(data)
if (data=="") {
$("#ajaxlogin").html("已经加载完了");
}else{
$("#ajaxlogin").hide();
setTimeout(function(){
$("#ajaxlogin").hide();
$.each( data, function( key, value ) {
var mm='<li class="w-video-li"><a href="javascript:;">{if $v.mktp}<img src="{$t_url}images/sp5.jpg" class="w-video-img">{else}<img src="'+data[key]['mktp']+'" class="w-video-img">{/if}<p class="w-pro-title">'+data[key]['name']+'</p><div class="w-detail-mask js-click-video" onclick="videoPLay(this);" data-url="'+data[key]['video']+'"></div></a></li>';
$(mm).appendTo('#num ul');
});
},1000);
}
})
}
});
<div class="w-video-wrap clearfix container" id="num" num="6">
<ul class="w-video-ul">
{foreach $video as $v}
<li class="w-video-li">
<a href="javascript:;" title="{$v.name}">
{if !$v.mktp}
<img src="{$t_url}images/sp5.jpg" alt="{$v.name}" class="w-video-img">
{else}
<img src="{$v.mktp}" alt="{$v.name}" class="w-video-img">
{/if}
<p class="w-pro-title">
{$v.name}
</p>
<div class="w-detail-mask" onclick="videoPLay(this);" data-url="{$v.video}" data-title="{$v.name}" data-date="2016-10-27" data-author="梵天">
</div>
</a>
</li>
{/foreach}
</ul>
</div>
<div id="ajaxlogin" class="line-scale" style="display: none;">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
public function videoajax(){
$num = $_POST['num'];
$video = $this->db->getAll("SELECT * FROM " . TABLE_PREFIX . "video ORDER BY sort DESC LIMIT $num, 6");
echo json_encode($video);
}