<div class="mobile-nav">
<div class="b-nav">
<ul>
<li><a class="b-link b-link--active" href="#">Item 1</a></li>
<li><a class="b-link" href="#">Item 2</a></li>
<li><a class="b-link" href="#">Item 3</a></li>
<li><a class="b-link" href="#">Item 4</a></li>
</ul>
<input type="text" class="mobile-search" placeholder="Enter keyword" name="">
<input type="submit" class="mobile-search-btn" value="Search">
</div>
<!-- Burger-Icon -->
<div class="b-container">
<div class="b-menu">
<div class="b-bun b-bun--top"></div>
<div class="b-bun b-bun--mid"></div>
<div class="b-bun b-bun--bottom"></div>
</div>
<!-- Burger-Brand -->
<a href="#" class="b-brand"></a>
</div>
</div>
body {
background-color: #323a59;
overflow:hidden;
}
body.open, body:after {
overflow: hidden
}
.b-nav, body:after {
position: absolute;
right: 0;
}
.b-brand, .b-link {
font-size: 18px;
font-weight: 700;
margin-left: 0;
text-decoration: none;
font-family: "Roboto Slab", serif;
text-transform: uppercase;
;
}
@-webkit-keyframes slideInLeft {
0% {
-webkit-transform: translate3d(345px, 0, 0);
transform: translate3d(345px, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
}
@keyframes slideInLeft {
0% {
-webkit-transform: translate3d(345px, 0, 0);
transform: translate3d(345px, 0, 0);
visibility: visible;
}
100% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
}
* {
box-sizing: border-box
}
body:after {
background: #000;
content: '';
height: 100%;
left: 0;
opacity: 0;
padding: 0;
top: 0;
visibility: hidden;
-webkit-transition: all .6s ease;
transition: all .6s ease;
width: 100%;
}
body.open:after {
z-index: 10;
opacity: 0.65;
height: 100000%;
visibility: visible
}
.b-nav {
background: #000 none repeat scroll 0 0;
position: absolute;
top: 0;
width: 320px;
z-index: 12;
}
.b-nav:not(.open) {
animation-duration: 0.4s;
animation-fill-mode: both;
-webkit-animation-name: slideOutLeft;
animation-name: slideOutLeft
}
.b-nav {
animation-duration: .4s;
animation-fill-mode: both;
-webkit-animation-name: slideInLeft;
animation-name: slideInLeft
}
.b-nav ul {
padding-left: 0px;
}
.b-nav li {
color: #fff;
list-style-type: none;
padding: 10px 10px 10px 0;
text-align: left;
-webkit-transform: translateX(345px);
-ms-transform: translateX(345px);
transform: translateX(345px)
}
.b-nav li:not(.open) {
animation-duration: 0.4s;
animation-fill-mode: both;
-webkit-animation-name: slideOutLeft;
animation-name: slideOutLeft
}
.b-nav li:not(.open), .b-nav.open li {
-webkit-animation-duration: 0.4s;
-webkit-animation-fill-mode: both
}
.b-nav li:first-child {
margin-top: 0px
}
.b-nav.open {
visibility: visible;
animation-duration: 0.4s;
animation-fill-mode: both;
-webkit-animation-name: slideInLeft;
animation-name: slideInLeft;
}
.b-nav:not(.open) {
visibility: hidden;
animation-duration: 0.4s;
animation-fill-mode: backwards;
-webkit-animation-name: slideOutLeft;
animation-name: slideOutLeft
}
.b-nav.open li {
padding-left: 30px;
animation-duration: 0.2s;
animation-fill-mode: both;
-webkit-animation-name: slideInLeft;
animation-name: slideInLeft
}
.b-link {
background: 0 0;
border-left: rgba(255, 255, 255, 0)solid 2px;
color: #fff;
transition: all .4s ease;
width: auto
}
.b-link, .b-menu {
-webkit-transition: all .4s ease;
}
.b-nav li {
border-left: 5px solid #e00a12;
}
/*.b-link--active,
.b-link:hover {
border-left: #e00a12 solid 5px;
padding-left: 30px
}*/
.b-menu {
cursor: pointer;
display: block;
height: 66px;
padding-top: 20px;
position: relative;
top: -20px;
transition: all 0.4s ease 0s;
width: 43px;
z-index: 12;
right: 10px;
}
.b-bun--bottom, .b-bun--mid, .b-bun--top {
height: 2px;
width: 25px
}
.b-container.open .b-main, .b-menu:hover {}
.b-bun {
background: #fff;
transition: all .4s ease
}
.b-brand, .b-bun {
position: relative;
-webkit-transition: all .4s ease
}
.b-bun--top {
top: 0
}
.b-bun--mid {
top: 8px
}
.b-bun--bottom {
top: 16px
}
.b-brand {
color: #2196f3;
top: -21.43px;
transition: all .4s ease;
z-index: 13
}
.b-container {
position: absolute;
right: 0;
top: 20px;
}
.b-container:hover:not(.open) .bun-bottom, .b-container:hover:not(.open) .bun-mid, .b-container:hover:not(.open) .bun-top {
background: #2196f3
}
.b-container.open .b-bun--top {
background: #e00a12;
top: 9px;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg)
}
.b-container.open .b-bun--mid {
opacity: 0
}
.b-container.open .b-bun--bottom {
background: #e00a12;
top: 5px;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg)
}
.b-container.open .b-brand {
color: #fff
}
.mobile-search-btn {
background-color: #e00a12;
border-radius: 4px;
color: #fff;
margin-bottom: 25px;
margin-left: 30px;
padding: 10px 20px;
text-transform: uppercase;
border:none;
}
.mobile-search {
background: transparent none repeat scroll 0 0;
border: 1px solid #fff;
color: #949494;
font-size: 14px;
margin-bottom: 20px;
margin-left: 30px;
padding: 10px;
width: 80%;
}
/********************** Mobile Menu ***********************/
'use strict';
(function() {
var body = document.body;
var burgerMenu = document.getElementsByClassName('b-menu')[0];
var burgerContain = document.getElementsByClassName('b-container')[0];
var burgerNav = document.getElementsByClassName('b-nav')[0];
burgerMenu.addEventListener('click', function toggleClasses() {
[body, burgerContain, burgerNav].forEach(function (el) {
el.classList.toggle('open');
});
}, false);
})();
/********************** Mobile Menu ***********************/
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.