-
Notifications
You must be signed in to change notification settings - Fork 724
/
mobile.html
246 lines (195 loc) · 8.84 KB
/
mobile.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>stroll.js - CSS3 Scroll Effects</title>
<meta name="description" content="A collection of CSS3 scroll effects and animations.">
<meta name="author" content="Hakim El Hattab">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/example.css">
<link rel="stylesheet" href="css/stroll.css">
<!-- Styles specifically for the mobile demo page -->
<style>
body {
overflow: hidden;
}
ul {
position: relative;
width: 100%;
}
ul li {
padding: 25px 20px;
-webkit-transform: translate3d( 0, 0, 1px );
}
ul li.cache {
-webkit-transform: rotateY( 1deg );
}
.settings {
display: none;
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 2;
background: rgba( 0, 0, 0, 0.85 );
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.opened .settings {
display: block;
}
.settings .effects li {
color: #fff;
background: #000;
}
.settings .effects li:nth-child(odd) {
border-top: 1px solid #333;
border-bottom: 1px solid #333;
}
.settings .effects li.active {
color: #70df54;
}
.settings p {
padding: 0px 50px 0px 20px;
}
.android .settings .effects li[data-exclude*="android"] {
display: none;
}
.settings-toggle {
position: fixed;
width: 32px;
height: 32px;
top: 10px;
right: 10px;
z-index: 3;
-webkit-touch-callout: none;
-webkit-user-select: none;
background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWVJREFUeNpiYCAPJADxfzScwEBHcB+LA87Ty3IHLJbDsAG1LAEF53ogDsAiNx+PA+bjMSuB3PgFBXcDECsQ8D1yKIDU9gPxe1LTSQIRFlCKURzBhOYAfzqkIRQ7mNEkOXHEOzVBJRDfwKfgPQ2D/z66ZcxYHCABxBY08v1EID6ALMCIRZECNpeigQNQwz4g6YmH5hJ8QBGIHxByZQCeIHxPICsRykUOhEq4+QQMCCCjHMFWWDmgazhPRALaT0Jc7ycyQYJDk9gUHEBiUU6UuUwkGHqBBLUPiFXIxDDAgBQHkFLVKpBa9d4fgER4Hj1L0zMbGpDb4qG0IMKwmJKieCFSaqdqUdxAw9qwn9wWL7Xwe0oqIpo0ydDbA+1ArEGH8mclroJoIx0s30hqPn4PTTzENssdoGobsKQnkvoGuDoTpHZMAkjtmFDSNXNgoBM4T0yLlxjATKYDfmKpFwpJbDOAAUCAAQA1C13UHZxFWAAAAABJRU5ErkJggg==) no-repeat;
}
.opened .settings-toggle {
background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAS5JREFUeNrUV4sRwiAMDZ2AETpCnUC7QUfoKG7CCm6gToAjuIFugImHPbxrS6Ag+O7etT3SvPALQQATxpgOHwNyjzwsmF2QV+RJCHGDFEDhEalNOOifcYtwizyb7SAfbaj4gHyYdCBfQ8iQ58LI6XlufI2EcOccHxopIS+eyB3ukjt9NE6D+oE4WA0VM++KuR21teWvB4ZjZe2kx5bapLX1BaGnDMcRd4JdCmISd2x9QXSNTa9r6FzHuHhoEfVIN9XSe2/bpkDpX4/vAZjZbq53n5FYa/NmSQjM7XNCseJvQMQBI1cSmQw9uCDylJMpxAkNlMY/TUG2RVh8Gx43iIfYzOFYPBWXP4yqOI5tECkqYHalXE1JVrworassr+JiUsXVLOHl1NtrUfp6/hJgANSnkcpCjbkhAAAAAElFTkSuQmCC) no-repeat;
}
</style>
</head>
<body>
<div class="settings-toggle"></div>
<div class="settings">
<p>
stroll.js - CSS3 scroll effects. <small>Created by <a href="http://twitter.com/hakimel">@hakimel</a>.</small>
</p>
<ul class="effects fly-simplified">
<li class="curl">Curl</li>
<li class="helix">Helix</li>
<li class="flip">Flip</li>
<li class="wave">Wave</li>
<li class="fly-simplified">Fly</li>
<li class="cards">Cards</li>
<li class="fan" data-exclude="android">Fan</li>
<li class="tilt">Tilt</li>
<li class="papercut" data-exclude="android">Papercut</li>
<li class="zipper" data-exclude="android">Zipper</li>
<li class="twirl">Twirl</li>
</ul>
</div>
<ul class="example-list" class="curl">
<!-- For this demo, items are created via JS -->
</ul>
<script src="js/stroll.js"></script>
<!-- The JS below is used to control the demo page -->
<script>
(function(){
var entries = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen', 'Twenty', 'Twentyone', 'Twentytwo', 'Twentythree', 'Twentyfour', 'Twentyfive', 'Twentysix', 'Twentyseven', 'Twentyeight', 'Twentynine', 'Thirty', 'Thirtyone', 'Thirtytwo', 'Thirtythree', 'Thirtyfour', 'Thirtyfive', 'Thirtysix', 'Thirtyseven', 'Thirtyeight', 'Thirtynine', 'Forty', 'Fortyone', 'Fortytwo', 'Fortythree', 'Fortyfour', 'Fortyfive', 'Fortysix', 'Fortyseven', 'Fortyeight', 'Fortynine', 'Fifty', 'Fiftyone', 'Fiftytwo', 'Fiftythree', 'Fiftyfour', 'Fiftyfive', 'Fiftysix', 'Fiftyseven', 'Fiftyeight', 'Fiftynine', 'Sixty', 'Sixtyone', 'Sixtytwo', 'Sixtythree', 'Sixtyfour', 'Sixtyfive', 'Sixtysix', 'Sixtyseven', 'Sixtyeight', 'Sixtynine', 'Seventy', 'Seventyone', 'Seventytwo', 'Seventythree', 'Seventyfour', 'Seventyfive', 'Seventysix', 'Seventyseven', 'Seventyeight', 'Seventynine', 'Eighty', 'Eightyone', 'Eightytwo', 'Eightythree', 'Eightyfour', 'Eightyfive', 'Eightysix', 'Eightyseven', 'Eightyeight', 'Eightynine', 'Ninety', 'Ninetyone', 'Ninetytwo', 'Ninetythree', 'Ninetyfour', 'Ninetyfive', 'Ninetysix', 'Ninetyseven', 'Ninetyeight', 'Ninetynine'];
// Keep the list height in sync with the window height
window.addEventListener( 'orientationchange', updateHeight, false );
window.addEventListener( 'resize', updateHeight, false );
var IS_ANDROID = navigator.userAgent.match( /android/gi ),
IS_IPHONE = navigator.userAgent.match( /iphone/gi );
var exampleList = document.querySelector( '.example-list' ),
effectsList = document.querySelector( '.settings .effects' ),
settingsToggle = document.querySelector( '.settings-toggle' ),
settingsPanel = document.querySelector( '.settings' );
var html = '';
// Unfortunately all devices aren't capable of running very long lists
// so let's adapt in favor of smooth animations
if( IS_ANDROID ) entries.length = 30;
if( IS_IPHONE ) entries.length = 60;
for( var i = 0, len = entries.length; i < len; i++ ) {
// The cache class is applied as an attempt to force Android to run
// all list items through the GPU at start to avoid lag later
var attributes = IS_ANDROID ? 'class="cache"' : '';
html += '<li ' + attributes + '>'+ entries[i] +'</li>';
}
exampleList.innerHTML = html;
if( IS_ANDROID ) {
document.body.classList.add( 'android' );
var exampleElements = exampleList.querySelectorAll( 'li' );
for( var i = 0, len = exampleElements.length; i < len; i++ ) {
exampleElements[i].classList.remove( 'cache' );
}
}
// Set the default effect
changeEffect( 'curl' );
// Run an initial height update
updateHeight();
// Toggle the appearance of the settings panel when the
// button is tapped
settingsToggle.addEventListener( 'touchstart', function( event ) {
if( /open/gi.test( document.body.className ) ) {
document.body.classList.remove( 'opened' );
}
else {
document.body.classList.add( 'opened' );
stroll.bind( effectsList );
}
}, false );
// Monitors clicks on effect types in the settings panel
effectsList.addEventListener( 'touchend', function( event ) {
// TODO Figure out a cleaner way to prevent propagation from
// within stroll.js
setTimeout( function() {
if( !event.defaultPrevented ) {
if( event.target && event.target.nodeName.toLowerCase() === 'li' ) {
changeEffect( event.target.className );
// Close the settings panel
document.body.classList.remove( 'opened' );
}
}
}, 0 );
}, false );
/**
* Changes to a new type of effect style, this also updates
* the settings UI to highlight the correct style.
*
* @param {String} type The name of the effect to apply
*/
function changeEffect( type ) {
var previousSelector = document.querySelector( '.settings .effects .' + exampleList.className ),
currentSelector = document.querySelector( '.settings .effects .' + type );
exampleList.className = type;
if( previousSelector ) {
previousSelector.classList.remove( 'active' );
}
if( currentSelector ) {
currentSelector.classList.add( 'active' );
}
}
/**
* Updates the list height to match the window height for
* the demo. Also re-binds the list with stroll.js.
*/
function updateHeight() {
exampleList.style.height = window.innerHeight + 'px';
effectsList.style.height = ( window.innerHeight - effectsList.offsetTop ) + 'px';
stroll.bind( 'ul' );
}
})();
</script>
</body>
</html>