移动端滑动加载更多
2016-01-04 14:21
435 查看
1 、 滑动到底部再加载数据
$(function(){
$(window).scroll(function(){
var scrollH = document.documentElement.scrollHeight;
var clientH = document.documentElement.clientHeight;
if (scrollH == (document.documentElement.scrollTop | document.body.scrollTop) + clientH){
//加载新数据
alert(“加载新数据”);
}
});
});
2 、 滑动一个屏幕再加载新的图片
$(function(){
$(window).scroll(function(){
var scrollH = document.documentElement.scrollHeight;
var clientH = document.documentElement.clientHeight;
if (scrollH == (document.documentElement.scrollTop | document.body.scrollTop) + clientH){
//加载新数据
alert(“加载新数据”);
}
});
});
2 、 滑动一个屏幕再加载新的图片
$(function(){ $(window).scroll( function(){ var heightwindow = $(window).height(); var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; var heightwindowsishewuru = Math.round(heightwindow/100) * 100; if((document.body.scrollTop % heightwindowsishewuru == 0 && document.body.scrollTop != 0 && document.documentElement.scrollTop == 0) || (document.body.scrollTop == 0 && document.documentElement.scrollTop % heightwindowsishewuru == 0 && document.documentElement.scrollTop != 0)){ //当往下滑一个屏幕的时 候再加载 alert("加载新的图片"); } }); });
相关文章推荐
- object-c ubuntu下开发环境搭建
- Swift - Struct 與 Class 的差異性
- WordPress过滤器(Filters):apply_filters和add_filter(转)写的太牛了
- iOS 用NSUserDefaults保存对象的方法
- Objective-C Runtime 运行时之一到六
- android 在函数中使用return,让后面的代码不再执行
- android常见的库文件
- android常见的库文件
- Android Studio 手机运行时中文乱码
- java servlet手机app访问接口(一)数据加密传输验证
- IOS调节屏幕的光线感应度
- Android编程使用ListView实现数据列表显示的方法
- android 获取全局context
- android-Adding Animations
- Android wav头添加
- CocosBuilder使用记录
- Android APK反编译详解(附图)
- Android 异步消息处理机制 让你深入理解 Looper、Handler、Message三者关系
- Android adb环境配置
- iOS常用的加密方式--备用