Skip to content

Instantly share code, notes, and snippets.

@MarioRicalde
Last active August 29, 2015 14:05
Show Gist options
  • Save MarioRicalde/cba39c7a37b877458112 to your computer and use it in GitHub Desktop.
Save MarioRicalde/cba39c7a37b877458112 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
</head>
<body>
<div id="site-wrapper">
<div id="site-canvas">
<nav id="site-menu">
<ul>
<li class="personal active"><a href="/">Home</a></li>
<li class="business "><a href="/business">Business</a></li>
<li class=""><a href="/sources">Sources</a></li>
<li class=""><a href="/faq">Help</a></li>
<li class="login">
<a class="account-button" href="/account/login">Log in</a>
</li>
<li class="or">
or
</li>
<li class="signup">
<a class="account-button" href="/account/register">Sign up</a>
</li>
</li>
</ul>
</nav>
</div>
</div>
</body>
</html>
$(document).ready(function() {
$(".menu-button").click(function(e) {
$("#site-wrapper").toggleClass("show-nav");
return false;
});
return $("#site-canvas").click(function() {
if ($('#site-wrapper').hasClass("show-nav")) {
return $("#site-wrapper").removeClass("show-nav");
}
});
});
#site-wrapper {
position: relative;
overflow: hidden;
width: 100%;
}
#site-canvas {
width: 100%;
height: 100%;
position: relative;
-webkit-transform: translateX(0);
transform: translateX(0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transition: 300ms ease all;
transition: 300ms ease all;
}
.show-nav #site-canvas {
-webkit-transform: translateX(200px);
transform: translateX(200px);
transform: translate3d(200px, 0, 0);
-webkit-transform: translate3d(200px, 0, 0);
}
#site-menu {
width: 200px;
height: 100%;
position: absolute;
top: 0;
left: -200px;
background: #333332;
font-size: 0.9em;
font-weight: bold;
-webkit-box-shadow: inset -10px 0 6px -9px rgba(0, 0, 0, .7);
-moz-box-shadow: inset -10px 0 6px -9px rgba(0, 0, 0, .7);
box-shadow: inset -10px 0 6px -9px rgba(0, 0, 0, .7);
overflow: auto;
-webkit-overflow-scrolling: touch; /* enables momentum scrolling in iOS overflow elements */
ul {
list-style: none;
margin: 0;
padding: 0;
li {
margin: 0;
}
}
.or {
display: none;
}
li a {
display: block;
color: #b3b3b1;
padding: 15px 30px;
border-bottom: 1px solid rgba(0, 0, 0, .1);
border-top: 1px solid rgba(255, 255, 255, .1);
text-decoration: none;
&:hover {
background: #00b4ff;
color: #FFF;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment