mirror of
https://github.com/bradfrost/this-is-responsive.git
synced 2026-04-18 03:00:06 -04:00
137 lines
4.0 KiB
HTML
137 lines
4.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8' />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="stylesheet" type="text/css" media="all" href="../styles.css">
|
|
<title>Responsive Pattern | This Is Responsive</title>
|
|
<script type="text/javascript" src="../js/modernizr.js"></script>
|
|
</head>
|
|
<body>
|
|
<!--Pattern CSS-->
|
|
<style id="s" type="text/css">
|
|
.offcanvas-top {
|
|
position: relative;
|
|
overflow: hidden;
|
|
height: 3.2em;
|
|
-webkit-transition: height 0.5s ease-out;
|
|
-moz-transition: height 0.5s ease-out;
|
|
-o-transition: height 0.5s ease-out;
|
|
transition: height 0.5s ease-out;
|
|
}
|
|
.offcanvas-top.active {
|
|
height: 13.6em;
|
|
}
|
|
.oc-content {
|
|
width: 100%;
|
|
position: absolute;
|
|
bottom: 0;
|
|
padding: 1em 1em 2.5em;
|
|
|
|
}
|
|
.crumbs li a {
|
|
display: block;
|
|
padding: 1em;
|
|
border-bottom: 1px solid #000;
|
|
}
|
|
.crumbs li:last-child a {
|
|
border-bottom: 0;
|
|
}
|
|
#trigger {
|
|
position: absolute;
|
|
bottom: 0;
|
|
right: 0;
|
|
display: block;
|
|
font-size: 1em;
|
|
padding: 0 1em 1em;
|
|
}
|
|
</style>
|
|
<!--End Pattern HTML-->
|
|
|
|
<!--Pattern HTML-->
|
|
<section id="pattern" class="pattern">
|
|
<div class="offcanvas-top">
|
|
<div class="oc-content">
|
|
<p>Here is more content. This could be related items, navigation or other content you feel is conducive to this type of treatment.</p>
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean quis nisi et dui placerat ornare. Maecenas molestie lacus lobortis libero lacinia sed scelerisque lectus congue. Mauris dignissim nisi a ante laoreet et ullamcorper ligula ullamcorper. In hac habitasse platea dictumst. In nisi odio, tempor in viverra vitae, mollis ac tortor. Sed a rhoncus leo. Maecenas ac dui elit, tristique dapibus nisl. Suspendisse feugiat porta ligula, auctor posuere lorem vulputate et.
|
|
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<!--End Pattern HTML-->
|
|
|
|
<!--Pattern JS (if needed)-->
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
|
|
<script type="text/javascript">
|
|
(function(w){
|
|
var $container = $('.offcanvas-top'),
|
|
$cHeight = $('.oc-content').outerHeight();
|
|
$(document).ready(function() {
|
|
buildCanvas();
|
|
});
|
|
|
|
function buildCanvas() {
|
|
$('<a href="#" id="trigger">More +</a>').appendTo($container);
|
|
|
|
$('#trigger').bind('click', function(e) {
|
|
e.preventDefault();
|
|
var $this = $(this);
|
|
$container.toggleClass('active');
|
|
|
|
if($container.hasClass('active')) {
|
|
$container.height($cHeight);
|
|
$this.text('Hide -');
|
|
} else {
|
|
$container.height(50);
|
|
$this.text('More +');
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
$(window).resize(function() { //On Window resizeBy(
|
|
$cHeight = $('.oc-content').outerHeight();
|
|
});
|
|
|
|
|
|
})(this);
|
|
</script>
|
|
|
|
<div class="container">
|
|
<!--Pattern Description-->
|
|
<section class="pattern-description">
|
|
<h1>Off-Canvas Top</h1>
|
|
<p>More content or navigation can be displayed off-canvas above the core content. </p>
|
|
<h2>Pros</h2>
|
|
<ul>
|
|
<li>Saves space for core content.</li>
|
|
<li>Elegant</li>
|
|
</ul>
|
|
<h2>Cons</h2>
|
|
<ul>
|
|
<li><strong>JS Dependency</strong> - Not necessarily a con, but ensure that off-canvas content is still accessible for users with poor/no JS support</li>
|
|
<li><strong>Animation Performance</strong> - Platforms, especially mobile platforms, vary greatly in how well they treat animations. Keep this in mind.</li>
|
|
</ul>
|
|
<h2>Resources</h2>
|
|
<ul>
|
|
<li><a href="http://www.lukew.com/ff/entry.asp?1517">Off Canvas Multi-Device Layout</a></li>
|
|
<li><a href="http://www.lukew.com/ff/entry.asp?1569">Off Canvas Multi-Device Layouts</a></li>
|
|
<li><a href="http://jasonweaver.name/lab/offcanvas/">Off-Canvas demo by Jason Weaver</a></li>
|
|
</ul>
|
|
</section>
|
|
<!--End Pattern Description-->
|
|
|
|
<!--Footer-->
|
|
<footer role="contentinfo">
|
|
<div>
|
|
<nav id="menu">
|
|
<a href="../patterns.html">←More Responsive Patterns</a>
|
|
</nav>
|
|
</div>
|
|
</footer>
|
|
<!--End Footer-->
|
|
</div>
|
|
</body>
|
|
</html>
|