wide menu on left
by lovromar
HTML
<nav class="main-nav" id="main-nav"> <a href="#">1</a>
<a href="#">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a
href="#">5</a> <a href="#">6</a>
</nav>
<div class="page-wrap">
<header class="main-header"> <a href="#main-nav" class="open-menu menu-button">
☰
</a>
<a href="#" class="close-menu menu-button">
☰
</a>
<h1>cssPanelMenu</h1>
</header>
<div class="content">
<p>It’s all about playing four quarters. I think we played well but the other
team played well too. They took advantage of certain circumstances that
arose. It’s a physical game.</p>
<p>We tried to capitalize on some mistakes they made. In the third quarter
they ran some plays. They are very good at throwing the football. They
have a good quarterback who is a real leader. There are no statistics for
that.</p>
<p>We just need to show up, take things day by day, and prepare for the future.
We’re looking at next week. We’re very optimistic. We’ll need to tighten
up our game, make less mistakes, and stay focused.</p>
<p>There are 22 players out there. We’re 11 of them. This is a game played
on grass. It’s full of intangibles. There are ups and downs. If we look
at today’s champions, they are proven winners. They play football.</p>
<p>The groundwork has been laid so, now let’s look the future, make some
good decisions, and take things to the next level.</p>
<p>It’s all about playing four quarters. I think we played well but the other
team played well too. They took advantage of certain circumstances that
arose. It’s a physical game.</p>
<p>We tried to capitalize on some mistakes they made. In the third quarter
they ran some plays. They are very good at...
CSS
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin:0;
padding:0;
}
html, body {
min-height: 100%;
}
a {
text-decoration: none;
}
.main-header {
height:85px;
background: #3f94bf;
padding: 5px;
text-align: center;
color: white;
text-shadow: #222222 0px -1px 1px;
position: fixed;
width: 100%;
left: 0;
}
.main-header a {
position: absolute;
left: 20px;
top: 20px;
color: white;
font-size: 32px;
}
.page-wrap {
float: right;
width: 100%;
}
.main-nav {
position: fixed;
top: 85px;
width: 20%;
height: 100%;
background: #3B3B3B;
overflow: hidden;
}
.main-nav a {
display: block;
background: #3e3e3e;
border-top: 1px solid #484848;
border-bottom: 1px solid #2E2E2E;
color: white;
padding: 15px;
}
.main-nav a:hover, .main-nav a:focus {
background: #484848;
}
.main-nav:after {
content:"";
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 34px;
}
.content {
padding: 100px 20px 20px 20px;
margin-left: 5px;
left: 0px;
}
.close-menu {
display: none;
}
JavaScript
$('#main-nav').hide();
$.fn.ToggleFix = function (odd, even) {
return this.each(function () {
var Toggled = false;
$(this).on("click", function () {
if (Toggled) {
Toggled = false;
return odd.apply(this, arguments);
}
Toggled = true;
return even.apply(this, arguments);
});
});
};
//what do you want each toggle to do
function odd() {
$('#main-nav').show();
$(".content").css({
"margin-left": "20%",
"margin-right": "-20%"
});
}
function even() {
$('#main-nav').hide();
$(".content").css({
"margin-left": "0%",
"margin-right": "0%"
});
}
//call your toggle method like this after creating the function you want above
$(function () {
$(".menu-button").ToggleFix(even, odd);
});