@import "bourbon";
// Main Vars
//Primary colors
$gray : rgb(146,146,146);
$dirty-white : rgb(247,247,247);
$dove-gray : rgb(110,110,110);
$black : rgb(0, 0, 0);
$white : rgb(255,255,255);
$tangerine : #FA3251;
$charlotte : rgb(198,232,246);
$silver : rgb(204,204,204);
// Base vars
$body-bg : linear-gradient(to bottom, rgba(246,46,36,1) 0%, rgba(255,54,121,1) 100%);
$text-color : rgba(255,255,255, 0.8);
$link-color : $tangerine;
// Navbar colors.
$nav-bg : #333;
$nav-links-color: rgba(255, 255, 255, 0.7);
// Helper mixins
// Opacity with fallback for IE8
@mixin opacity($opacity) {
opacity: $opacity;
$opacity-ie: $opacity * 100;
filter: alpha(opacity=$opacity-ie); //IE8
}
// RGBA fallback
@mixin rgba($property, $background: white, $opacity: 0.5, $mix: white) {
#{$property}: mix($background, $mix, $opacity * 100%);
#{$property}: rgba($background, $opacity);
}
// General Styles to make Everything ok.
@import url("https://fonts.googleapis.com/css?family=Lato");
* {
box-sizing: border-box;
}
html {
background: $body-bg;
font-size: 16px;
line-height: 1.5;
font-family: 'Lato', sans-serif;
color: $text-color;
overflow: hidden;
}
body, html {
width: 100%;
height: 100%;
}
#site-wrapper {
position: relative;
width: 100%;
height: 100%;
padding-left: 40px;
}
main {
*zoom: 1;
width: auto;
max-width: 1200px;
float: none;
display: block;
margin-right: auto;
margin-left: auto;
padding-left: 10px;
padding-right: 10px;
margin-top: 20px;
}
main:before, main:after {
content: '';
display: table;
}
main:after {
clear: both;
}
/* Navbar Menu Component */
.menu {
width: 300px;
height: 100%;
background: $nav-bg;
position: fixed;
top: 0;
right: -300px;
backface-visibility: hidden;
overflow: hidden;
transform: translateX(0);
transform: translateX(0) translateZ(0);
transform: translate3d(0, 0, 0);
transition: all 0.3s cubic-bezier(0.32,1.25,0.375,1.15);
z-index: 10;
&.show-nav {
transform: translateX(-300px);
transform: translateX(-300px) translateZ(0);
transform: translate3d(-300px, 0, 0);
}
ul {
margin: 0;
padding: 0;
li {
position: relative;
list-style: none;
width: 60%;
margin: 0 auto;
padding: 20px 10px;
text-align: center;
border-top: 1px solid #333;
box-shadow: 0 -1px 1px -1px #746559;
&:first-child {
margin-top: 20px;
border: 0;
box-shadow: none;
}
a {
position: relative;
font-weight: 300;
padding: 8px 10px;
color: $nav-links-color;
color: rgb(255, 255, 255);
text-decoration: none;
text-transform: uppercase;
transition: all 0.25s ease-in-out;
&:after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 1px;
background-color: $tangerine;
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s cubic-bezier(0.32,1.25,0.375,1.15);
}
.no-touch &:hover {
//color: $tangerine;
&:after {
transform: scale(1);
visibility: visible;
}
}
}
}
}
p {
color: $nav-links-color;
position: absolute;
top: 86%;
left: 20px;
font-size: em(14px);
text-align: center;
a {
color: $tangerine;
text-decoration: none;
transition: all 0.3s ease;
&:hover {
color: $tangerine;
text-decoration: underline;
}
}
}
}
.nav-toggle {
position: fixed;
top: 30px;
right: 30px;
backface-visibility: hidden;
transform: translateX(0);
transform: translateX(0) translateZ(0);
transform: translate3d(0, 0, 0);
transition: all 0.4s cubic-bezier(0.32,1.25,0.375,1.15);
z-index: 11;
span {
color: rgba(255, 255, 255, 0.8);
padding: 5px;
font-size: em(30px);
.no-touch &:hover {
color: white;
}
&.fa-times {
color: #fff;
&:hover {
color: #fff;
}
}
}
&.show-nav {
top: 12px;
right: 12px;
}
}
View Compiled
// Vars
var wrapper = $("#site-wrapper"),
menu = $(".menu"),
menuLinks = $(".menu ul li a"),
toggle = $(".nav-toggle"),
toggleIcon = $(".nav-toggle span");
function toggleThatNav() {
if (menu.hasClass("show-nav")) {
if (!Modernizr.csstransforms) {
menu.removeClass("show-nav");
toggle.removeClass("show-nav");
menu.animate({
right: "-=300"
}, 500);
toggle.animate({
right: "-=300"
}, 500);
} else {
menu.removeClass("show-nav");
toggle.removeClass("show-nav");
}
} else {
if (!Modernizr.csstransforms) {
menu.addClass("show-nav");
toggle.addClass("show-nav");
menu.css("right", "0px");
toggle.css("right", "330px");
} else {
menu.addClass("show-nav");
toggle.addClass("show-nav");
}
}
}
function changeToggleClass() {
toggleIcon.toggleClass("fa-times");
toggleIcon.toggleClass("fa-bars");
}
$(function() {
toggle.on("click", function(e) {
e.stopPropagation();
e.preventDefault();
toggleThatNav();
changeToggleClass();
});
// Keyboard Esc event support
$(document).keyup(function(e) {
if (e.keyCode == 27) {
if (menu.hasClass("show-nav")) {
if (!Modernizr.csstransforms) {
menu.removeClass("show-nav");
toggle.removeClass("show-nav");
menu.css("right", "-300px");
toggle.css("right", "30px");
changeToggleClass();
} else {
menu.removeClass("show-nav");
toggle.removeClass("show-nav");
changeToggleClass();
}
}
}
});
});
alsolike(
"NNzGVd", "Search input context animation",
"aOQddB", "Open & Close Animation",
"wBOder", "Subtle Icons hover effect"
);
/* Thanks to:
@fbrz for the "You might also like" plugin
*/