Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2013 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/7118036 to your computer and use it in GitHub Desktop.
Save anonymous/7118036 to your computer and use it in GitHub Desktop.
A Pen by Anonasaurus Rex.
<section>
<nav>
<a class="navicon-button loading">
<div class="navicon"></div>
</a>
<a class="navicon-button larr">
<div class="navicon"></div>
</a>
<a class="navicon-button uarr">
<div class="navicon"></div>
</a>
<a class="navicon-button x">
<div class="navicon"></div>
</a>
<a class="navicon-button plus">
<div class="navicon"></div>
</a>
<a class="navicon-button">
<div class="navicon"></div>
</a>
</nav>
<h1>Click the icons!</h1>
</section>
$("a").click(function(){
$(this).toggleClass("open");
$("h1").addClass("fade");
});
@import "compass";
/* Change this to watch in slo-mo */
$transition-duration: .5s;
$size : 100%;
$toggled-size : .75;
$bodybg : #449a88;
$navbg : #2a2a2a;
$pagebg : #e7e6dd;
.navicon-button {
display: inline-block;
position: relative;
padding: 2.0625rem 1.5rem;
transition: $transition-duration/2;
cursor: pointer;
user-select: none;
opacity: .8;
.navicon:before, .navicon:after {
transition: $transition-duration/2;
}
&:hover {
transition: $transition-duration;
opacity: 1;
.navicon:before, .navicon:after {
transition: $transition-duration/2;
}
.navicon:after { top: -.825rem; }
.navicon:before { top: .825rem; }
}
}
.navicon {
position: relative;
width: 2.5em;
height: .3125rem;
background: $pagebg;
transition: $transition-duration;
border-radius: 2.5rem;
&:after, &:before {
display: block;
content: "";
height: .3125rem;
width: 2.5rem;
background: $pagebg;
position: absolute;
z-index: -1;
transition: $transition-duration ($transition-duration/2);
border-radius: 1rem;
}
&:after { top: -.625rem; }
&:before { top: .625rem; }
}
.open:not(.steps) .navicon:before,
.open:not(.steps) .navicon:after {
top: 0 !important;
}
.open .navicon:before,
.open .navicon:after {
transition: $transition-duration;
}
/* Minus */
.open { transform: scale($toggled-size); }
/* Arrows */
.open.larr .navicon,
.open.uarr .navicon {
&:before, &:after {
width: 1.5rem;
}
&:before { transform: rotate(35deg); transform-origin: left top; }
&:after { transform: rotate(-35deg); transform-origin: left bottom; }
}
.open.uarr { transform: scale($toggled-size) rotate(90deg); }
/* × and + */
.open.plus,
.open.x {
.navicon {
background: transparent;
&:after { transform: rotate(45deg); }
&:before { transform: rotate(-45deg); }
}
}
.open.plus { transform: scale($toggled-size) rotate(45deg) }
.loading .navicon {
color: dodgerblue;
box-shadow: inset 0 0;
transition: $transition-duration, box-shadow 0;
}
.loading .navicon { transition: 0; }
.open.loading {
transform: none;
.navicon {
box-shadow: inset 2.5rem 0;
transition: $transition-duration, box-shadow $transition-duration*5;
&:before, &:after { opacity: 0; }
}
}
/* Base ================== */
* { box-sizing: border-box; }
html { font-size: $size; }
html, body, section { position: relative; height: 100%; }
body {
background: $bodybg;
padding: 1.5rem 1.5rem 0;
-webkit-backface-visibility: hidden;
}
section {
display: flex;
flex-direction: column;
justify-content: space-between;
border-radius: .5rem .5rem 0 0;
background: $pagebg;
overflow: hidden;
/* Smoother animations */
& *,
& *:before,
& *:after {
transform: translate3d(0,0,0);
}
}
nav {
height: 4.5rem;
background: $navbg;
text-align: right;
border-radius: .5rem .5rem 0 0;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
h1 {
text-align: right;
font: 2rem/4.5rem "Kite One";
padding: 0 1.5rem;
opacity: .5;
transition: $transition-duration*2;
pointer-events: none;
&.fade {
opacity: 0;
}
}
@font-face {
font-family: 'Kite One';
font-style: normal;
font-weight: 400;
src: local('Kite One'), local('KiteOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/kiteone/v1/VNHoD96LpZ9rGZTwjozAOnYhjbSpvc47ee6xR_80Hnw.woff) format('woff');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment