Skip to content

Instantly share code, notes, and snippets.

@Laidlaw
Created February 2, 2013 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Laidlaw/4696017 to your computer and use it in GitHub Desktop.
Save Laidlaw/4696017 to your computer and use it in GitHub Desktop.
A CodePen by Laidlaw. cssPanelMenu - Based on http://jpanelmenu.com/ css solution: http://codepen.io/Jenn/pen/tIFaH back button fix: http://codepen.io/jetpacmonkey/pen/ktIJz This is a beautiful solution and because it has no javascript, it works much more smoothly on mobile. There are only a few caveats. You can't just plug it in, it relies on a…
<nav class="main-nav" id="main-nav">
<ul>
<a href="#">Dr. Pepper</a>
<a href="#">Coka-Cola</a>
<a href="#">Cheerwine</a>
<a href="#">Nav 4</a>
<a href="#">Nav 5</a>
<a href="#">Nav 6</a>
<a href="#">Dr. Pepper</a>
<a href="#">Coka-Cola</a>
<a href="#">Cheerwine</a>
</ul>
</nav>
<div class="page-wrap">
<header class="main-header">
<a href="#main-nav" class="open-menu">
</a>
<a href="#" class="close-menu">
</a>
<h1>cssPanelMenu</h1>
</header>
<div class="content row">
<img src="http://placehold.it/980x350">
<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 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>
</div>
</div>
/*
CSS version of
http://jpanelmenu.com/
*/
@import "compass";
* {
box-sizing: border-box;
}
html, body { min-height: 100%; }
a { text-decoration: none; }
ul {padding:0; margin:0; }
img {
max-width: 100%;
height: auto;
border:5px solid white;
}
.main-header {
background: linear-gradient(#3F94BF, #246485);
padding: 5px;
text-align: left;
padding-left: 20px;
color: white;
text-shadow: #222 0px -1px 1px;
position: static;
width: 100%;
left: 0;
transition: all 0.3s ease;
a {
position: absolute;
left: 20px;
top: 20px;
color: white;
font-size: 32px;
}
}
.page-wrap {
float: right;
width: 100%;
transition: width 0.3s ease;
background:url('http://placehold.it/50x50');
}
.content {
padding: 20px 20px 20px 20px;
}
.main-nav {
position: fixed;
background: #3B3B3B;
a {
display: inline-block;
color: white;
padding: 15px;
background: linear-gradient(#3E3E3E, #383838);
&:hover, &:focus { color: #3F94BF; }
}
}
.close-menu {
display: none;
}
.open-menu {
display: none;
}
@media (max-width:768px) {
body {
background:#3e3e3e;
@include background-image(linear-gradient( left, rgba(black, 0), rgba(black, 0) 25%, rgba(black, 0.4) 30%, rgba(black, 0.4)));
}
/*ul {
position: static;
height:100%;
background: #3F94BF;
display:block;
}*/
.open-menu {
display: block;
}
.main-header {
position: fixed;
text-align: center;
z-index:500;
}
.content {
padding-top: 100px;
}
.main-nav {
position: fixed;
top: 0;
-webkit-overflow-scrolling:touch;
overflow:auto;
overflow-y: scroll;
width: 0;
height: 100%;
transition: width 0.3s ease;
a {
display: block;
background: linear-gradient(#3E3E3E, #383838);
border-top: 1px solid #484848;
border-bottom: 1px solid #2E2E2E;
&:hover, &:focus {
background: linear-gradient(#484848, #383838);
}
}
&:after {
content: "";
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 34px;
background: linear-gradient(left, rgba(black, 0), rgba(black, 0.4));
}
}
#main-nav:target {
width: 30%;
}
#main-nav:target + .page-wrap {
width: 70%;
.content {
opacity:.1;
}
.open-menu {
display: none;
}
.close-menu {
display: block;
}
.main-header {
width: 70%;
left: 30%;
}
}
.row {
width: auto;
min-width: 0;
margin-left: 0;
margin-right: 0;
}
}
/* styles from site */
@media (min-width:769px) {
.main-nav {position:relative; margin: 0 auto;}
ul {text-align:center;}
.row, .clearfix {
zoom: 1;
}
.row {
width: 100%;
max-width: 960px;
min-width: 727px;
margin: 0 auto;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment