手机翻页
时间:2022-03-12 06:02
<div id="newlist"></div>
<div class="no_more" width="30" height="30">正在努力加载中...</p</div> var pages = {:$totlepage:}; if(pages==1) { jQuery(‘.no_more‘).show(); } var page = 2, bool = true, st = jQuery(document).innerHeight(); function refresh(){ if(!bool){return;} bool = false; jQuery(‘.loading2‘).show(); jQuery(‘.no_more‘).hide(); var data = { ‘page‘ : page } $.post( ‘url‘, data, function(d){ if (d.length>0) { var html = ‘‘; for (var i = 0; i < d.length; i++) { html += ‘<li>‘; html += ‘d[i].name‘; html += ‘</li>‘; }; $(‘#newlist‘).append(html); page++; st = jQuery(document).innerHeight(); bool = true; jQuery(‘.loading2‘).hide(); jQuery(‘.no_more‘).hide(); }else{ bool = false; jQuery(‘.no_more‘).show(); jQuery(‘.loading2‘).hide(); } },‘json‘); } $(window).scroll(function(){ if (getScrollTop() + getClientHeight() >= getScrollHeight()) { refresh(); } }); //获取滚动条当前的位置 function getScrollTop() { var scrollTop = 0; if (document.documentElement && document.documentElement.scrollTop) { scrollTop = document.documentElement.scrollTop; }else if (document.body) { scrollTop = document.body.scrollTop; } return scrollTop; } //获取当前可是范围的高度 function getClientHeight() { var clientHeight = 0; if (document.body.clientHeight && document.documentElement.clientHeight) { clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight); } else { clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight); } return clientHeight; } //获取文档完整的高度 function getScrollHeight() { return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); }
相关推荐
- Android系统编程入门系列之界面Activity交互响应
- 新型横向移动工具原理分析、代码分析、优缺点以及检测方案
- uni-app滚动视图容器(scroll-view)之监听上拉事件
- uniapp h5,app两端复制文本
- Android系统编程入门系列之界面Activity响应丝滑的传统动画
- 【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
- 诺基亚短信生成!太好玩了
- iOS 跳转App Store进行评分
- 开发一个即时通讯App
- 关闭苹果IOS app自动更新
电脑软件
本类排行
- 1关闭苹果IOS app自动更新
- 2iOS 跳转App Store进行评分
- 3诺基亚短信生成!太好玩了
- 4Android系统编程入门系列之界面Activity响应丝滑的传统动画
- 5uniapp h5,app两端复制文本
- 6uni-app滚动视图容器(scroll-view)之监听上拉事件
- 7新型横向移动工具原理分析、代码分析、优缺点以及检测方案
- 8Android系统编程入门系列之界面Activity交互响应
- 9开发一个即时通讯App
- 10【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn