This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
/
index.html
451 lines (390 loc) · 16.1 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
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Overthrow</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
/* Overthrow CSS:
Enable overflow: auto on elements with overthrow class when html element has overthrow-enabled class */
.overthrow-enabled .overthrow {
overflow: auto;
-webkit-overflow-scrolling: touch;
z-index: 0
}
.overthrow-enabled #content.overthrow {
height: 14em;
}
/* DEMO CSS IS GROSS */
body {
font-family: Helvetica, sans-serif;
margin: 0;
}
a {
color: #267402;
}
#header {
text-align: center;
background: #eee;
padding: .1em 5%;
margin-bottom: 0;
font-size: .8em;
color: #777;
border-bottom: 1px solid #ddd;
line-height: 1.5;
}
#header a {
border-width: 1px 0;
padding: .5em;
text-decoration: none;
background: #f3f3f3;
border-bottom: 1px solid #ddd;
}
#header a:hover,#header a:focus {
background: #fff;
}
.project-hed {
text-align: center;
font-weight: bold;
font-size: 3em;
margin: .25em 0 -2px;
overflow: hidden;
height: .8em;
line-height: .9;
position: relative;
}
.project-hed i {
font-style: normal;
background: #000;
color: #fff;
display: inline-block;
letter-spacing: -0.03em;
padding-right: .07em;
}
.version {
background: orange;
position: absolute;
font-size: .3em;
margin: 0;
padding: .4em;
color: #fff;
top: 0;
right: 0;
border: 1px solid darkorange;
font-weight: normal;
border-top-left-radius: .3em;
border-bottom-left-radius: .3em;
}
.project-sub {
background: #fff;
font-size: 1em;
padding: 0 4%;
text-align: center;
line-height: 1.5;
max-width: 30em;
}
.project-sub code {
white-space: nowrap;
background: #000;
color: #fff;
padding: .2em .4em;
display: inline-block;
}
#content {
margin: 0;
padding: 5px 2%;
max-width: 40em;
border: solid #000;
border-width: 2px 0;
}
#content #wat {
margin-top: 0;
}
.overthrow-enabled .overthrow #wat:after {
content: "\2193";
font-size: .8em;
padding: 0 .2em;
}
pre {
border: 1px dotted #aaa;
background: #eee;
line-height: 1.4;
padding: .5em 1.5em 2em;
display: block;
font-weight: normal;
}
#content h2, #content h3, #content h4 {
text-align: center;
font-weight: bold;
padding-top: 2em;
margin-top: 1em;
}
.code {
text-align: center;
}
#content p.code {
margin: 0;
}
#content p, #content li {
line-height: 1.5;
}
#content li {
margin-bottom: 1em;
}
.code a {
display: inline-block;
border: 1px solid #000;
padding: .5em;
text-decoration: none;
color: #000;
font-weight: bold;
position: relative;
}
.gh-fork em {
background: #000;
border-radius: 2em;
display: inline-block;
font-size: .8em;
padding: .3em;
color: #fff;
}
#browserstatus {
text-align: center;
}
#browserstatus p {
display: inline-block;
font-size: 1em;
}
#browserstatus p.native strong, td span {
color: #fff;
padding: .2em .5em;
font-weight: normal;
}
#browserstatus p.native strong, span.native {
background: green;
}
#browserstatus p.polyfilled strong, span.polyfilled {
background: orange;
}
#browserstatus p.none strong, span.none {
background: red;
}
table {
width: 100%;
border-collapse: collapse;
}
td, th {
border: 1px solid #ddd;
padding: .3em 1em;
text-align: left;
}
tr.you td {
background: papayawhip; /* @wilto holla */
}
td span {
border-radius: .3em;
display: inline-block;
}
input, select, textarea, label, button {
font-size: 1.2em;
padding: .3em;
display: block;
}
textarea {
max-width: 90%;
}
label {
margin: 1em 0 .5em;
}
button {
display:inline-block;
}
tr:nth-child(even){
background: #eee;
}
#nav {
text-align: center;
}
#nav ul {
max-width: 43em;
padding: 0;
margin: 0 auto;
}
#nav ul, #nav li {
display: block;
list-style: none;
}
#nav li {
font-size: .9em;
text-align: center;
}
#nav li a {
display: block;
text-decoration: none;
padding: .5em 0;
margin: 0 2%;
border-bottom: 1px solid #ddd;
}
.embedder {
border: 1px solid #000;
margin: 1em;
padding: 20px;
}
.overthrow-enabled .embedder {
height: 220px;
}
#content {
margin: 0 auto;
}
@media (min-width: 40em){
.version {
font-size: .2em;
}
#header {
margin-bottom: 2em;
}
.gh-fork {
background: url("https://a248.e.akamai.net/assets.github.com/img/c641758e06304bc53ae7f633269018169e7e5851/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f77686974655f6666666666662e706e67");
position: absolute;
top: 0;
left: 0;
text-indent: -99999em;
width: 130px;
height: 130px;
margin: 0;
border: 0;
}
.project-hed {
font-size: 5em;
}
.project-sub {
padding: 1em 10%;
margin: 0 auto;
font-size: 1.3em;
}
#nav ul {
margin: 1em auto;
padding: 0;
text-align: center;
}
#nav li, #nav li a {
display: inline-block;
padding: 0 .5em;
margin: 0;
border: 0;
}
}
</style>
<script src="lib/toss/toss.js"></script>
<script src="src/overthrow-detect.js"></script>
<script src="src/overthrow-polyfill.js"></script>
<script src="src/overthrow-toss.js"></script>
<script src="src/overthrow-init.js"></script>
<script src="extensions/anchorscroll.overthrow.js"></script>
</head>
<body>
<div id="header">
<p>Crafted with care by Scott@<a href="http://filamentgroup.com">Filament Group</a></p>
</div>
<h1 class="project-hed"><i>Overthrow</i> <span class="version" title="Initial development release">0.2.1</span></h1>
<div id="content" class="overthrow">
<p id="top" class="project-sub">A <em><span title="1.6kb min/gz">tiny</span>, no-frills, framework-independent, targeted</em> <code>overflow: auto</code> polyfill for use in responsive design.</p>
<p id="toggleContain" class="code"></p>
<h2 id="wat">What is this all about?</h2>
<p>You want to use CSS <code>overflow</code> in your designs, but <code>overflow</code> doesn't work properly in many browsers, particularly mobile ones. Many popular mobile browsers treat <code>overflow: auto</code> the same as <code>overflow: hidden</code>, cropping overflow content from view, and leaving users no way to access it.</p>
<p>But wait - many browsers actually support <code>overflow</code> very well! In particular, desktop browsers tend to support it without a hitch, and many of the latest versions of most mobile platforms do too. The trouble is, it's hard – perhaps impossible – to test for <code>overflow</code> support, and even if we could use it safely where supported, many popular browsers lack that support and would be left with a degraded experience.</p>
<h2 id="wat-overthrow">What is Overthrow?</h2>
<p>Overthrow is a conservative attempt at filling the gaps in <code>overflow</code> support, with an emphasis on letting native implementations do their thing, and in touch-supporting browsers, providing a very minimal polyfill in browsers where native support is not available. Out of necessity, Overthrow examines the user agent string to whitelist the current and future versions of mobile platforms that are known to have native <code>overflow</code> support, but not before checking through more reliable and agnostic means: namely, iOS5's (and now Chrome Android's too!) touch scrolling CSS property, and a broad desktop browser inference test (no touch event support with a screen greater than 1200px wide). </p>
<p>First and foremost, Overthrow is designed to simply enable native CSS <code>overflow</code> in browsers it deems to have native support, but it includes a touch-scrolling polyfill too! In platforms that don't appear to support <code>overflow</code> natively, but do support touch events, Overthrow will polyfill the feature, allowing momentum-based scrolling in browsers that might otherwise be left with an innaccessible experience.</p>
<p>Perhaps most importantly, Overthrow enables <code>overflow</code> support as a qualified, progressive enhancement, meaning your content starts out uncropped and accessible, and properties like <code>width</code> and <code>height</code> are assigned only in browsers where overflow content can reliably be scrolled (either natively or with the polyfill). In browsers that don't support overflow natively, and also don't support touch events, the content will not receive dimensions at all, leaving users with a degraded but<em></em> accessible experience.</p>
<h2 id="examples">A few example pages</h2>
<p>The examples directory has some sample responsive layouts that use overthrow. If you're in a browser that supports overthrow, you'll find a link in the header to toggle it on and off, demonstrating the fallback experience for non-overflow browsers.</p>
<ul>
<li><a href="examples/2-column/">Responsive Columned Layout</a></li>
<li><a href="examples/dialog/">Responsive Dialog Layout</a></li>
</ul>
<h2>That's about it.</h2>
<h3>Here's some extra demo content to scroll through...</h3>
<h3>Example Embedded Overthrow Block</h3>
<p>Note: this may be a little clunky at the moment, as nesting isn't quite finished. Check out the nesting branch for progress.</p>
<div class="overthrow embedder">
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
</div>
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
<h3>Form elements</h3>
<form action="#" method="get">
<div>
<label for="name">Text Input:</label>
<input type="text" name="name" id="name" value="" />
</div>
<div>
<label for="textarea">Textarea:</label>
<textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
</div>
<div>
<label for="select-choice-1">Choose shipping method:</label>
<select name="select-choice-1" id="select-choice-1">
<option value="standard">Standard: 7 day</option>
<option value="rush">Rush: 3 days</option>
<option value="express">Express: next day</option>
<option value="overnight">Overnight</option>
</select>
</div>
<h2>Header Level 2</h2>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ol>
<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>
<h3>Header Level 3</h3>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ul>
<h2>Header Level 2</h2>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ol>
<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>
<h3>Header Level 3</h3>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
</ul>
<p>Okay, <a href="#top">Back to top, then?</a></p>
</div><!-- overthrow content -->
<div id="nav">
<ul>
<li><a href="#top" class="throw">Home</a></li>
<li><a href="#wat" class="throw">What is this all about?</a></li>
<li><a href="#wat-overthrow" class="throw">What is Overthrow?</a></li>
<li><a href="#features" class="throw">Features</a></li>
<li><a href="#support" class="throw">Support</a></li>
</ul>
</div>
<script src="examples/togglelink.js"></script>
<script>
// DEMO scripting
(function(w){
var doc = w.document,
o = overthrow;
// Enhance this page a bit
// report the browser enhancement status
var tbody = doc.getElementsByTagName("tbody")[0],
tr = doc.createElement( "tr" );
tr.className = "you";
tr.innerHTML = "<td>Your Browser</td><td><span class='"+ o.support + "'>" + o.support + "</span></td>";
tbody.insertBefore( tr, tbody.firstChild );
w.onload = function(){
setTimeout(function(){
if(!location.hash){
w.scrollTo(0,0);
}
},0);
};
})( this );
</script>
</body>
</html>