-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.html
executable file
·152 lines (145 loc) · 4.91 KB
/
test.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<head>
<title>scroll test</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style type="text/css" media="screen">
* { box-sizing: border-box;}
html,body { width:100%; height:100%; margin:0; padding:0;}
body { padding:40px; }
#container { overflow:hidden; width:100%; height:300px; box-shadow:1px 1px 20px rgba(0,0,0,0.3);}
#inner1 { line-height:4; text-align:center; font-family:Tahoma; position:relative; }
.red { background-color:#FF9799; color:white; }
.green { background-color:#47BA2C; color:white;}
.blue { background-color:#78B1F0; color:white;}
.pull-to-container { position:absolute; width:100%; height:50px; line-height:50px; text-align:center; color:#333; left:0; top:-50px; }
.pull-to-container.bottom { top:auto; bottom:-50px; }
#pages {
overflow:hidden; width:200px; height:200px; box-shadow:1px 1px 20px rgba(0,0,0,0.3);
margin-top:20px;
line-height:4; text-align:center;
}
#pages > #inner2 > div {
width: 200px;
height:200px;
}
#pages2 {
overflow:hidden; width:200px; height:200px; box-shadow:1px 1px 20px rgba(0,0,0,0.3);
margin:20px 0;
line-height:4; text-align:center;
}
#pages2 > #inner3 { height:200px; }
#pages2 > #inner3 > div {
width:200px;
height:200px;
display:block;
float:left;
}
</style>
</head>
<body>
<div id="container">
<div id="inner1">
<div class="pull-to-container">pull to refresh</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="pull-to-container bottom">drag to load more</div>
</div>
</div>
<div id="pages">
<div id="inner2">
<div class="red">vertical pages</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
</div>
</div>
<div id="pages2">
<div id="inner3">
<div class="red">horizontal pages</div>
<div class="green">green green green</div>
<!-- <div class="blue">blue blue blue</div>
<div class="red">red red red red</div>
<div class="green">green green green</div>
<div class="blue">blue blue blue</div>
<div class="red">red red red red</div> -->
</div>
</div>
<button onclick="addPage()">add</button>
<script src="nicemove.js"></script>
<script type="text/javascript">
var a = new NiceMove(document.getElementById("inner1"), false, true, { anchor:{top:50,bottom:50} });
var b = new NiceMove(document.getElementById("inner2"), false, true, { isPagedY: true });
var c = new NiceMove(document.getElementById("inner3"), true, false, {
isPagedX: true,
onPageChanged: function(a) {
if (a.index + 1 === document.getElementById("inner3").children.length) {
addPage();
}
}
});
function addPage() {
var el = document.createElement('div');
el.innerHTML = 'new new new ';
el.className = 'blue';
document.getElementById("inner3").appendChild(el);
c.resize(null, true);
}
window.addEventListener('resize', function()
{
a.resize();
a.slideTo(0, 0, 1);
});
var items = document.querySelectorAll('#inner1 > div');
var instances = [];
for(var i=0, d; d=items[i]; i++)
{
instances.push(new NiceMove(d, true, false , {
moveThresh: 10,
anchor:{
left:50,
right:50
}
}));
}
var state = 0;
</script>
</body>
</html>