Created
September 22, 2014 21:00
-
-
Save FluffyCode/8d4c3fa7882c14b9c301 to your computer and use it in GitHub Desktop.
Foundation: Off-canvas w/ fixed top-bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.off-canvas-fixed { | |
-webkit-transition: -webkit-transform 500ms ease; | |
transition: transform 500ms ease; | |
} | |
.move-right > .off-canvas-fixed { | |
height: 100%; | |
-webkit-transform: translate3d(15.625rem, 0, 0); | |
transform: translate3d(15.625rem, 0, 0); | |
} | |
.left-off-canvas-menu { | |
-webkit-transform: none; | |
transform: none; | |
margin-left: -15.625rem; | |
/* vh UNITS NICER THAN JS LISTENER */ | |
/* height: 100vh; */ | |
/* (BUT LESS SUPPORTED) */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="off-canvas-wrap"> | |
<div class="fixed off-canvas-fixed"> | |
<nav class="tab-bar"> | |
<section class="left-small"> | |
<a class="left-off-canvas-toggle menu-icon"><span></span></a> | |
</section> | |
<section class="right tab-bar-section"> | |
<h1 class="title">Foundation</h1> | |
</section> | |
</nav> | |
<aside class="left-off-canvas-menu"> | |
<ul class="off-canvas-list"> | |
<li><label>Useful Menu</label></li> | |
<li><a href="#">As a mobile device user,</a></li> | |
<li><a href="#">etc, etc, etc</a></li> | |
</ul> | |
</aside> | |
</div> | |
<div class="inner-wrap"> | |
<a class="exit-off-canvas"></a> | |
<section id="some-content-that-is-red-lol"> | |
<div class="row"> | |
<div class="large-12 columns"> | |
<br> | |
<h4>The Psychohistorians</h4> | |
<p>Set in the year 0 F.E. ("Foundation Era"), The Psychohistorians opens on Trantor, the capital of the 12,000-year-old Galactic Empire. Though the empire appears stable and powerful, it is slowly decaying in ways that parallel the decline of the Western Roman Empire. Hari Seldon, a mathematician and psychologist, has developed psychohistory, a new field of science and psychology that equates all possibilities in large societies to mathematics, allowing for the prediction of future events.</p> | |
<br><br><br>Workarounded.<br><br><br><br> | |
<p>Using psychohistory, Seldon has discovered the declining nature of the Empire, angering the aristocratic members of the Committee of Public Safety, the de facto rulers of the Empire. The Committee considers Seldon's views and statements treasonous, and he is arrested along with young mathematician Gaal Dornick, who has arrived on Trantor to meet Seldon. Seldon is tried by the Committee and defends his beliefs, explaining his theories and predictions, including his belief that the Empire will collapse in 500 years and enter a 30,000-year dark age, to the Committee's members. </p> | |
</div> | |
</div> | |
</section> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).foundation(); | |
var menu = $('.left-off-canvas-menu'); | |
$(document).on('resize', function() { | |
// Beware with resize handlers... | |
// Throttle & consolidate #perfmatters | |
menu.height($(this).height()); | |
}); | |
// Initialize height | |
$(document).trigger('resize'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example solution provided by David Govea:
http://foundation.zurb.com/forum/posts/547-off-canvas-with-fixed-top-bar?page=2
http://codepen.io/anon/pen/EBvCq