<header>
<nav>
<div class="menu-container">
<!-- Menu -->
<ul class="menu">
<li class="menu-apple">
<a href="#">
<i class="fa fa-apple apple-icon" aria-hidden="true"></i>
</a>
</li>
<li class="menu-mac">
<a href="#">
<span>Mac</span>
</a>
</li>
<li class="menu-iPad">
<a href="#">
<span>iPad</span>
</a>
</li>
<li class="menu-iPhone">
<a href="#">
<span>iPhone</span>
</a>
</li>
<li class="menu-watch">
<a href="#">
<span>Watch</span>
</a>
</li>
<li class="menu-tv">
<a href="#">
<span>TV</span>
</a>
</li>
<li class="menu-support">
<a href="#">
<span>Support</span>
</a>
</li>
<li class="menu-search">
<a href="#">
<i class="fa fa-search" aria-hidden="true"></i>
</a>
</li>
<li class="menu-store">
<a href="#">
<i class="fa fa-shopping-bag" aria-hidden="true"></i>
</a>
</li>
</ul>
<!-- Search -->
<div class="menu-search-container">
<div class="menu-search-input">
<form action="">
<a href="#">
<i class="fa fa-search" aria-hidden="true"></i>
</a>
<input class="menu-search-input" type="text" aria-label="Search apple.com" placeholder="Search apple.com" autocorrect="off" autocapitalize="off" autocomplete="off" spellcheck="false">
</form>
</div>
<a class="menu-search-close" href="#">
<i class="fa fa-close" aria-hidden="true"></i>
</a>
<div class="search-sub-menu">
<h3>Quick Links</h3>
<ul>
<li><a href="#">Find a store</a></li>
<li><a href="#">Accessories</a></li>
<li><a href="#">iPod</a></li>
<li><a href="#">iOS</a></li>
<li><a href="#">Gift Cards</a></li>
</ul>
</div>
</div>
</div>
</nav>
</header>
<div class="fade-screen"></div>
// ----------------------------
// BASE STYLES
// ----------------------------
.vh {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.fade-screen {
background: rgba(0,0,0,0.2);
visibility: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
}
// ----------------------------
// ANIMATIONS
// ----------------------------
@keyframes specialFadeIn {
from {
opacity: 0;
transform: scale(0.8);
}
to {
opacity: 1;
}
}
.specialFadeIn {
animation-name: specialFadeIn;
}
@keyframes specialFadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
transform: scale(0.8);
}
}
.specialFadeOut {
animation-name: specialFadeOut;
}
@keyframes specialSlideInRight {
from {
transform: translate3d(10%, 0, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
.specialSlideInRight {
animation-name: specialSlideInRight;
}
@keyframes specialFadeInRight {
from {
opacity: 0;
transform: translate3d(10%, 0, 0);
}
to {
opacity: 1;
transform: none;
}
}
.spceialFadeInRight {
animation-name: specialFadeInRight;
}
.menu-search-container.active {
display: block;
animation-name: specialFadeOut;
transition: opacity 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.visible {
visibility: visible;
}
.hidden {
display: none;
transition: opacity 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
.menu {
ul li {
transition: opacity 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
}
.menu-mac {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 30ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 245ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-iPad {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 70ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 210ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-iPhone {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 100ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 170ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-watch {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 130ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 130ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-tv {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 170ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 100ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-support {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 210ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 70ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-search {
&.is-closed {
animation-name: specialFadeIn;
animation-delay: 245ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-delay: 30ms;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-store {
&.is-closed {
animation-name: specialFadeIn;
animation-duration: 400ms;
animation-fill-mode: both;
}
&.hidden {
animation-name: specialFadeOut;
animation-duration: 400ms;
animation-fill-mode: both;
}
}
.menu-search-input {
animation-name: specialFadeInRight;
animation-duration: 400ms;
animation-fill-mode: both;
animation-delay: 350ms;
}
.search-sub-menu h3 {
animation-name: specialFadeInRight;
animation-duration: 700ms;
animation-fill-mode: both;
}
.search-sub-menu ul li {
animation-name: specialFadeInRight;
animation-duration: 500ms;
animation-fill-mode: both;
&:nth-child(1) {
animation-delay: 0ms;
}
&:nth-child(2) {
animation-delay: 30ms;
}
&:nth-child(3) {
animation-delay: 50ms;
}
&:nth-child(4) {
animation-delay: 70ms;
}
&:nth-child(5) {
animation-delay: 90ms;
}
}
// ----------------------------
// NAV
// ----------------------------
nav {
position: absolute;
top: 0;
right: 0;
left: 0;
height: 48px;
min-width: 1024px;
background: rgba(0,0,0,0.8);
font-size: 18px;
z-index: 2;
}
.menu-container {
position: relative;
margin: 0 auto;
margin-top: -5px;
max-width: 980px;
padding: 0 22px;
ul {
list-style: none;
}
ul li {
display: inline-block;
text-align: center;
width: auto;
margin-right: 76px;
&:last-child {
margin-right: 0;
}
}
ul li a {
display: inline-block;
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
text-decoration: none;
color: #fff;
font-weight: 100;
font-size: 16px;
float: left;
&:hover {
color: #969696;
}
}
&.menu-apple {
background-repeat: no-repeat;
width: 20px;
}
}
.apple-icon {
font-size: 20px;
}
// ----------------------------
// NAV Search Form
// ----------------------------
.menu-search-container {
display: none;
position: absolute;
top: 0;
left: 20.6667%;
width: 56.66667%;
z-index: 2;
input {
background-color: transparent;
border: none;
width: 80%;
font-size: 16px;
outline: none;
color: #fff;
}
a {
color: #fff;
&:first-child {
display: block;
float: left;
padding-right: 10px;
}
}
&.active {
display: block;
}
}
.menu-search-close {
position: absolute;
right: -183px;
top: 0;
}
// Sub Menu
.search-sub-menu {
background: #fff;
width: 100%;
margin-top: 14px;
color: #999;
font-weight: 100;
padding: 24px 0 15px;
z-index: 1;
h3 {
font-size: 12px;
font-weight: 100;
margin-top: 0;
padding-left: 28px;
}
ul {
margin: 0;
padding: 0;
width: 100%;
li {
display: block;
text-align: left;
padding-bottom: 10px;
margin: 0;
text-indent: 50px;
a {
font-size: 14px;
color: #999;
width: 100%;
padding-top: 5px;
padding-bottom: 5px;
&:hover {
background-color: #f2f2f2;
color: #3392de;
}
&:first-child {
float: none;
padding-right: 0;
}
}
}
}
}
View Compiled
(function() {
'use strict';
var $searchView = $('.menu-search-container');
var $menu = $('.menu-mac, .menu-iPad, .menu-iPhone, .menu-watch, .menu-tv, .menu-support, .menu-search, .menu-store');
var $fadeScreen = $('.fade-screen');
$('li.menu-search a, .fade-screen, .menu-search-close').on('click', function(e) {
$searchView.toggleClass('active');
setTimeout(function(){
$searchView.children().find('input').focus();
}, 1100);
$fadeScreen.toggleClass('visible');
$menu.removeClass('is-closed');
$menu.toggleClass('hidden');
e.preventDefault();
});
$('.fade-screen,.menu-search-close').on('click', function(e) {
$menu.toggleClass('is-closed');
e.preventDefault();
});
}())