Skip to content

Instantly share code, notes, and snippets.

@MrQwest
Created August 4, 2014 21:37
Show Gist options
  • Save MrQwest/424fb64f65e4e867fb84 to your computer and use it in GitHub Desktop.
Save MrQwest/424fb64f65e4e867fb84 to your computer and use it in GitHub Desktop.
header {
background-color: rgba(255,255,255,1);
position: absolute;
top: 40%;
left:0;
width: 100%;
}
nav {
position: absolute;
display: block;
width: 100%;]
left: 0;
/* -webkit-transition: width 2s; */
}
nav ul {
background-color: white;
line-height: 6rem;
text-align: right;
display: block;
width: 100%;
}
nav ul li {
display: inline-block;
text-decoration: none;
padding-left: 1rem;
}
.nav-button {
line-height: 6rem;
background-color: #e24234;
display: inline-block;
width: 6rem;
text-align: center;
color: white;
font-size: 2rem;
position: absolute;
top: 40%;
z-index: 33;
}
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<header>
<nav>
<ul>
<li><a href="/"></a>Home</li>
<li><a href="/about">About</a></li>
<li><a href="/portfolio">Portfolio</a></li>
<li><a href="/contacg">Contact</a></li>
</ul>
</nav>
<div class="nav-button">
E
</div>
</header>
</body>
</html>
$('nav').css({"top": "38%", "left": -$('nav').outerWidth()}).hide();
// console.log($('nav').width());
$('.nav-button').on('click', function() {
var $left = $('nav');
console.log($left.outerWidth());
$left.show().animate({
left: parseInt($left.css('left'),10) === 0 ?
-$left.outerWidth() :
0
}, 800,"swing" /*this 'easing' argument was missing */,function() {
console.log("completed");
$('header').delay(500).animate({
top: 0
}, 1200);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment