-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
136 lines (123 loc) · 2.73 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta id="viewport" name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name=”apple-mobile-web-app-status-bar-style” content=black” />
<title>下拉刷新</title>
<style>
body, a, ul, li, div {
margin:0;
padding:0;
}
body {
background:#eee;
}
ul {
list-style-type:none
}
a {
color:#444;
text-decoration:none;
font-size:14px;
}
a:hover {
color:#000;
}
.header,
.footer {
height: 40px;
line-height: 40px;
background: #666;
color: #fff;
text-align: center;
}
.wrap {
position: relative;
overflow: hidden;
}
.content li {
padding-left: 20px;
line-height: 50px;
border-bottom:1px solid #ddd;
}
</style>
</head>
<body>
<div class="header">
header
</div>
<div class="wrap">
<div class="content" id="J_scroller">
<ul>
<li class="row">Row 1</li>
<li class="row">Row 2</li>
<li class="row">Row 3</li>
<li class="row">Row 4</li>
<li class="row">Row 5</li>
<li class="row">Row 6</li>
<li class="row">Row 7</li>
<li class="row">Row 8</li>
<li class="row">Row 9</li>
<li class="row">Row 10</li>
<li class="row">Row 11</li>
<li class="row">Row 12</li>
<li class="row">Row 13</li>
<li class="row">Row 14</li>
<li class="row">Row 15</li>
<li class="row">Row 16</li>
<li class="row">Row 17</li>
<li class="row">Row 18</li>
<li class="row">Row 19</li>
<li class="row">Row 20</li>
<li class="row">Row 21</li>
<li class="row">Row 22</li>
<li class="row">Row 23</li>
<li class="row">Row 24</li>
<li class="row">Row 25</li>
<li class="row">Row 26</li>
<li class="row">Row 27</li>
<li class="row">Row 28</li>
<li class="row">Row 29</li>
<li class="row">Row 30</li>
</ul>
</div>
</div>
<div class="footer">
footer
</div>
</body>
</html>
<script src="zepto.min.js"></script>
<script src="zepto.refresh.js"></script>
<script>
var totalNumber = 30;
$(window).refresh({
contentEl: '#J_scroller',
// 头部的高度
distanceToRefresh: 40,
// 开启刷新
isRefresh: true,
// 开启加载更多
isLoadingMore: true,
// 触发刷新回调
refreshCallback: function(complete) {
setTimeout(function() {
window.location.reload();
complete();
}, 1000)
},
// 加载更多回调
loadingMoreCallback: function(complete) {
var tpl = '';
for (var i = 0; i < 10; i++) {
totalNumber++;
tpl += '<li class="row">Row '+ totalNumber +'</li>'
}
$('#J_scrller ul').append(tpl);
complete('finish');
}
});
</script>