代码如下 注释 用的是 layui 的msg提示 如果你用的插件是layui可以吧注释去掉
<script type="text/javascript">
if(window.name != "off"){
var tin = false;
var loadingc = false;
window.name = "off";
}
var totalHeight = $(document).height();
var seeHeight = $(window).height();
var thisBodyHeight = $(document.body).height();
var totalBodyHeight = $(document.body).outerHeight(true);
var thisWidth = $(window).width();
var thisDocumentWidth = $(document).width();
var thisBodyWidth = $(document.body).width();
var totalBodyWidth = $(document.body).outerWidth(true);
var scrollTop = $(window).scrollTop();
$(window).scroll(function(){
if(!$('.yeshu')){
$('body').append('<div class="yeshu" style="display: none;">1</div>');
}
yeshu = parseInt($('.yeshu').html())+1;
if(tin!=true && loadingc!=true){
scrollTop = $(window).scrollTop();
totalHeight = $(document).height();
if(scrollTop+seeHeight+70>totalHeight){
loadingc = true;
yeshu = parseInt($('.yeshu').html())+1;
$.get("/index.php/vod/type_api/id/"+yeshu+".html",function(data,status){
data = $.trim(data);
if(data!=''){
$('.videoListBox').append(data);
$('.yeshu').html(yeshu);
}else{
$('.videoListBox2').append('<p style="display:block;text-align:center;margin-top: 20px;margin-bottom: 20px;color: #979797;">到底咯,没有更多数据了</p><p></p>');
tin = true;
}
loadingc = false;
});
}
}
})
</script>
|