-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.html
76 lines (72 loc) · 2.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="iscroll.js"></script>
<script src="pullToRefresh.js?"></script>
<link rel='stylesheet' type='text/css' href = 'pullToRefresh.css'>
<style>
* {
margin:0;
padding:0;
}
html {
height:100%;
}
body {
height:100%;
}
#container {
position:relative;
height:100%;
overflow:hidden;
background-color:#f1f1f1;
}
.item {
height: 80px;
border-bottom: 1px solid black;
text-align: center;
line-height:80px;
}
</style>
<script>
$(document).ready(function() {
// 测试用的数据下标
var i = 0;
// 安装下拉刷新插件
var pullToRefresh = $.installPullToRefresh("#container", {
onRefresh: function(refreshDone) {
setTimeout(function() {
$("#content").html("");
// 刷新后出现10个
for (i = 0; i < 10; ++i) {
$("#content").append('<p class="item">第' + i + "个元素</p>");
}
refreshDone();
}, 2000)
},
onLoad: function(loadDone) {
setTimeout(function() {
// 每次加载增加5个
for (var j = 0; j < 5; ++j) {
$("#content").append('<p class="item">第' + i++ + "个元素</p>");
}
loadDone();
}, 0);
},
// noRefresh: true,
// noLoad: true,
});
// 触发首屏渲染
pullToRefresh.triggerPull();
});
</script>
</head>
<body>
<div id="container">
<div id="content"></div>
</div>
</body>
</html>