首页 技术 正文
技术 2022年11月11日
0 收藏 705 点赞 4,390 浏览 1429 个字

1 下载最新的iscroll5,本文版本是5.1.3

2 提取iscroll-probe.js,选择这个文件的原因是我们要给iscroll扩展一个事件,需要用到probeType 属性

3 修改iscroll-probe.js的源码,添加上拉监听事件slideUp (
iscroll 5 源码注释  http://www.ghugo.com/iscroll-5-source/)

4 编辑页面

Html:

"<div id='lookupScrollerWrapper'>"+
"<div>"+
"<div>"+
"<ul data-role='listview' id='assListId0000'></ul>"+
"</div>"+
"<div id='lookupScrollerPullUp' style='display:none'>"+
"<span>上拉加载更多</span>"+
"</div>"+
"</div>"+
"</div>"

css:

#lookupScrollerWrapper {
position: absolute;
top: 54px;
bottom: 0px;
width: 100%;
overflow: hidden;
}#lookupScrollerPullUp {
height: 40px;
line-height: 40px;
font-size: 12px;
font-weight: bold;
color: grey;
text-shadow: none;
text-align:center;
position:absolute;
width:100%;
bottom:-40px;
}

js:

lookupScroll = new IScroll('#lookupScrollerWrapper', { probeType: 3, mouseWheel: true, click: true });lookupScroll.on("scroll", function() {
if(this.maxScrollY - this.y >= 40){
$("#lookupScrollerPullUp").css("display", "");
}
});lookupScroll.on("slideUp", function() {
if(this.maxScrollY - this.y >= 40) {
this.scrollTo(0, this.maxScrollY-47, 3000, IScroll.utils.ease.back);
$(this)._associateKey();
}
}); $('#lookupScrollerWrapper').on('touchmove', function(){
if(lookupScroll.maxScrollY - lookupScroll.y >= 40){
$('#lookupScrollerPullUp').html("释放加载更多");
}
}); $('#lookupScrollerWrapper').on('touchend', function(){
if(lookupScroll.maxScrollY - lookupScroll.y >= 40){
$('#lookupScrollerPullUp').html("正在加载..");
} else {
$('#lookupScrollerPullUp').html("上拉加载更多");
}
});

6 如果页面是动态编辑的,则要调用刷新的代码,否则页面不会滚动

lookupScroll.refresh();

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,495
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,133
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,297