-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdemo.html
69 lines (55 loc) · 1.04 KB
/
demo.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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>Active Scroll</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
#start,#mid,#end{
position: fixed;
right: 0;
}
#start{
top: 0;
}
#mid {
top: 15px;
}
#end{
top: 30px;
}
</style>
</head>
<body>
<div>test page</div>
<ul class="list">
</ul>
<script type="text/javascript" src="./js/zepto.js"></script>
<script type="text/javascript" src="./js/active_scroll.js"></script>
<script type="text/javascript">
var isLoading = false;
var m = 0;
function createString(){
var str = '';
for(var n = 0; n < 80; n++){
str += '<li>list' + (m++) + '</li>';
}
return str;
};
var as = $('.list').activeScroll();
as.addItems(createString());
$(window).on('scroll',function(){
if(window.scrollY + window.innerHeight >= document.body.clientHeight && !isLoading){
isLoading = true;
setTimeout(function(){
as.addItems(createString());
isLoading = false;
},500);
}
});
</script>
</body>
</html>