This repository has been archived by the owner on Jun 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
138 lines (117 loc) · 2.94 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
137
138
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PreviewScroll</title>
<link rel="stylesheet" href="previewScroll.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
h1 {
font-size: 18px;
}
p {
color: #555;
font-style: italic;
font-family: serif;
padding: 3px;
}
.status {
background: #f2f2f2;
width: 100px;
height: 100px;
text-align: center;
margin: auto;
display:-webkit-box;
-webkit-box-pack:center;
-webkit-box-align:center;
}
.left-panel {
width: 150px;
float: left;
position: relative;
text-align: center;
}
.right-panel {
float: right;
position: relative;
}
</style>
</head>
<body>
<div class='left-panel'>
<h1>Preview Scroll</h1>
<p>Scroll the list and preview an item by placing it under the highlighted area.</p>
<div class='status'></div>
</div>
<div class='right-panel'>
<ul id='scrollDemo'>
<li>Route Begins</li>
<li>Hello 1</li>
<li>Hello 2</li>
<li>Hello 3</li>
<li>Hello 4</li>
<li>Hello 5</li>
<li>Hello 6</li>
<li>Hello 7</li>
<li>Hello 8</li>
<li>Hello 9</li>
<li>Hello 10</li>
<li>Hello 11</li>
<li>Hello 12</li>
<li>Hello 13</li>
<li>Hello 14</li>
<li>Hello 15</li>
<li>Hello 16</li>
<li>Hello 17</li>
<li>Hello 18</li>
<li>Hello 19</li>
<li>Hello 20</li>
<li>Hello 21</li>
<li>Hello 22</li>
<li>Hello 23</li>
<li>Hello 24</li>
<li>Hello 25</li>
<li>Hello 26</li>
<li>Hello 27</li>
<li>Hello 28</li>
<li>Hello 29</li>
<li>Hello 30</li>
<li>Hello 31</li>
<li>Route Ends</li>
</ul>
</div>
<script src='raf.js'></script>
<script>
AnimationFrame.shim();
</script>
<script src='previewScroll.js'></script>
<script>
(function () {
/* global PreviewScroll*/
var previewScroll;
var enforceListHeight = function () {
console.log('Height enforced');
var windowHeight = window.innerHeight;
var ul = document.querySelector('#scrollDemo');
ul.style.maxHeight = window.innerHeight + 'px';
};
window.addEventListener('resize', function () {
enforceListHeight();
previewScroll.updateLayout();
});
document.addEventListener('DOMContentLoaded', function () {
enforceListHeight();
previewScroll = new PreviewScroll('#scrollDemo', {pause_time: 200, offset_items: 1});
previewScroll.onPreview = function (target) {
document.querySelector('.status').innerHTML = target.textContent;
};
});
} ());
</script>
</body>
</html>