Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
451 lines (389 sloc) 16.2 KB
<!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="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>
Something went wrong with that request. Please try again.