body
header
nav#mainnav(role="navigation")
ul
li
a(href="#")
i.fa.fa-home
span Home
li
a(href="#")
i.fa.fa-smile-o
span About
li
a(href="#")
i.fa.fa-globe
span Clients
li
a(href="#")
i.fa.fa-envelope-o
span Contact Us
li
a(href="#")
i.fa.fa-bars
section
h1 Simple Nav
View Compiled
$backgroundColor: #c13237;
$mainTextColor: #ffffff;
$animationSpeed: 0.25s;
$navItems: 4;
$navSize: 1.75em;
body {
font-size: 16px;
color: $mainTextColor;
background: $backgroundColor;
font-family: "Raleway", arial, sans-serif;
}
h1 {
text-align: center;
font-size: 6em;
font-weight: 300;
position: absolute;
margin: 0;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#mainnav {
ul {
padding-left: 1em;
position: fixed;
bottom: 0;
font-weight: 400;
z-index: 100;
min-width: 20em;
}
li {
list-style: none;
margin: 0.5em 0 0;
font-size: $navSize;
&:hover span {
opacity: 1;
transition: $animationSpeed;
}
}
li.invisible {
opacity: 0;
visibility: hidden;
transition: all $animationSpeed;
}
li.animate {
opacity: 0;
animation-duration: $animationSpeed;
animation-name: easeOutBounce;
animation-fill-mode: forwards;
}
a {
text-decoration: none;
color: $mainTextColor;
}
i {
border: 2px solid $mainTextColor;
padding: 0.5em;
border-radius: 50%;
}
span {
color: $backgroundColor;
padding: 0.35em;
margin-left: 0.5em;
border-radius: 0.2em;
font-size: 0.75em;
transition: 0.3s;
background: #fff;
opacity: 0;
position: relative;
&:before {
content: "";
width: 0px;
height: 0px;
position: absolute;
left: -0.4em;
top: 50%;
margin-top: -0.5em;
border-style: solid;
border-width: 0.5em 0.5em 0.5em 0;
border-color: transparent $mainTextColor transparent transparent;
}
}
}
@keyframes easeOutBounce {
0% {
font-size: 0;
}
37% {
font-size: $navSize;
}
55% {
font-size: $navSize * 0.75;
}
73% {
font-size: $navSize;
}
82% {
font-size: $navSize * 0.93;
}
91% {
font-size: $navSize;
}
96% {
font-size: $navSize * 0.98;
}
100% {
font-size: $navSize;
opacity: 1;
}
}
View Compiled
Nav = {
init : ->
this.setup();
this.uiBind();
setup : ->
$('#mainnav')
.find('li:not(:last-child)')
.toggleClass('invisible');
uiBind : ->
$(document).on 'click', '#mainnav', (e)->
(e).preventDefault();
$(this).find('li:not(:last-child)')
.toggleClass('animate')
.toggleClass('invisible');
}
Nav.init();
View Compiled