The Backside Menu Flip
First off, let me apologize for the fact that this page is loading an iframe. I had to do this because of a huge conflict in the CSS being loaded.
The idea behind this responsive menu is that as we get to a certain width (less than 768px), the menu goes away and we are presented with a single "menu" button. Pretty standard stuff. Then when that button is clicked, the entire page flips around to reveal the navigation.
The navigation takes up the entire "backside" of the page. This gives you lots of flexibility to style the menu to however you see fit!
I also like the user's experience here. By watching the site flip they know that they are viewing a different panel. As opposed to putting your menu in the footer and using an anchor link (which could cause an abrupt jump) this methods lets the user see what's happening. It's a similar thought process behind the "off-canvas" page slide which facebook uses.
Right now this is just in beta. While working with navigation in responsive design, I thought it might be fun to put the menu on the "backside" of the page content. This frees us up to do whatever the hell we want with the menu on the backside of the page! It might not be quite semantic and probably doesn't yet* provide a fallback solution, but that shouldn't be too hard! ***Update: I added a fallback for devices without Javascript OR devices that don't support CSS transformations. If a device doesn't have JS or support CSS transforms, then the menu simply appears in the footer and the menu link at the top anchors them to that position in the footer.
*Weird bug: there seems to be an issue with adding elements inside the front-facing container with position: relative;
- so I had to make my responsive grid elements position: inherit;
.
The CSS
.span-5, .span-7 { position: inherit; }
header.cf { margin-bottom: 2em; }
header.cf > h1 { text-align: center; }
article { padding: 5em; }
header.cf nav { width:100%; border-bottom: 1px solid #ccc; padding: .6em 0; }
header.cf ul { list-style: none; padding: 0px; margin: 0px; font-weight: bold; text-align: center; }
header.cf ul li { display: inline-block; text-align: left; }
header.cf ul li a { display: block; padding: 5px 10px; text-decoration: none; color: #444; }
header.cf ul li a:hover { background-color: #ccc; }
.anchor-link { display: none; font-weight: bold; padding: 0 1em; text-align: right; text-decoration: none; color: #8A2404; float: right; }
#mobile-nav { display:none; }
p.copyright { text-align: center; }
#mobile-nav ul { list-style: none; margin: 0px; padding: 0px; }
#mobile-nav ul li { list-style: none; text-align: center; }
#mobile-nav ul li a { display: block; padding: 20px 10px; border-bottom: 1px solid #ccc; text-decoration: none; }
#mobile-nav ul li a:hover { background-color: #ccc; color: #fff; }
@media (max-width:48.000em){
article { padding: 1.5em; }
header.cf nav { padding: 0.6em 0; }
header.cf nav > ul { display: none; }
.anchor-link, #mobile-nav { display: block; }
.back header.cf { padding: .8em 0; background-color: #444; }
.back header.cf .anchor-link { color: #fff; }
#page_container {
position: relative;
margin: 0px auto;
width: 100%;
z-index: 1;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
-o-perspective: 1000px;
perspective: 1000px;
}
#main_content {
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
-webkit-transition: all 1.0s linear;
-moz-transform-style: preserve-3d;
-moz-transition: all 1.0s linear;
-o-transform-style: preserve-3d;
-o-transition: all 1.0s linear;
transform-style: preserve-3d;
transition: all 1.0s linear;
}
#page_container.active #main_content {
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
-webkit-box-shadow: -5px 5px 5px #aaa;
-moz-box-shadow: -5px 5px 5px #aaa;
box-shadow: -5px 5px 5px #aaa;
}
.face {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
.face.back {
display: block;
-webkit-transform: rotateY(180deg);
-webkit-box-sizing: border-box;
-moz-transform: rotateY(180deg);
-moz-box-sizing: border-box;
-o-transform: rotateY(180deg);
-o-box-sizing: border-box;
transform: rotateY(180deg);
color: white;
text-align: center;
}
.no-js #mobile-nav,
.no-csstransforms3d #mobile-nav { display: block; border-top: 1px solid #ccc; }
.no-js .face,
.no-csstransforms3d .face{ position: relative; }
.no-js .face.back {
-webkit-transform: inherit;
-moz-transform: inherit;
-o-transform: inherit;
transform: inherit;
}
.no-js .back header,
.no-csstransforms .back header { display:none; }
}