<html lang="en">
<head>
<meta charset="UTF-8">
<title>Stretch navigation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="box-menu">
<div class="wrapper">
<div class="hamburger">
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div class="menu">
<a href="#" class="active"><span class="icon fa fa-info-circle"></span><span class="text">About Us</span></a>
<a href="#"><span class="icon fa fa-suitcase"></span><span class="text">Portfolio</span></a>
<a href="#"><span class="icon fa fa-shopping-basket"></span><span class="text">Store</span></a>
<a href="#"><span class="icon fa fa-phone"></span><span class="text">Contacts</span></a>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
@import 'https://fonts.googleapis.com/css?family=Ubuntu';
body { background: #eee; }
.box-menu {
position: absolute;
left: 50px;
top: 50px;
cursor: pointer;
background: #49A4EB;
width: 60px;
height: 60px;
box-shadow: 2px 3px 5px rgba(0,0,0,.3);
border-radius: 60px;
transition: height .4s;
}
.full-menu {
height: 300px;
}
.wrapper {
position: relative;
width: 60px;
height: 60px;
}
/*ГАМБУРГЕР*/
.hamburger {
position: absolute;
left: 22px;
top: 22px;
width: 16px;
height: 16px;
}
.hamburger span {
position: absolute;
display: inline-block;
height: 2px;
width: 100%;
background: #fff;
border-radius: 10px;
/*transition: top .3s, transform .3s, left .3s, width .3s;*/
transition: all .3s;
}
.hamburger span:nth-child(1) { top: 3px; }
.hamburger span:nth-child(2) { top: 8px; }
.hamburger span:nth-child(3) { top: 8px; }
.hamburger span:nth-child(4) { top: 13px; }
.hamburger.active span:nth-child(1) { width: 0; margin-left: 8px;}
.hamburger.active span:nth-child(2) { transform: rotate(45deg); }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg); }
.hamburger.active span:nth-child(4) { width: 0; margin-left: 8px;}
/*ОСНОВНОЕ МЕНЮ*/
.menu {
position: relative;
left: -9999px;
}
.menu a {
white-space: nowrap;
position: relative;
display: inline-block;
color: #333;
text-decoration: none;
width: 150px;
height: 58px;
line-height: 58px;
font-family: Ubuntu;
}
.menu a::after {
content: '';
position: absolute;
left: 57px;
top: 29px;
height: 0px;
width: 3px;
background: #fff;
transition: height .3s, top .3s;
}
.menu a.active::after {
top: 19px;
height: 20px;
}
.menu a span {
opacity: 0;
display: inline-block;
font-size: 14px;
}
.menu a span.icon {
transform: scale(.5);
color: #fff;
font-size: 18px;
display: inline-block;
width: 60px;
text-align: center;
transition: transform .3s;
}
.menu a span.text {
text-shadow: 1px 1px 0px rgba(0,0,0,.3);
opacity: 0;
margin-left: 40px;
transition: margin .3s, opacity .3s, transform .3s;
}
/*Развернутое меню*/
.full-menu .menu {
left: 0;
}
.full-menu .menu a {
/*opacity: .8;*/
}
.full-menu .menu a:hover span {
opacity: 1;
}
.full-menu .menu a span {
opacity: .8;
}
.full-menu .menu a span.icon {
transform: scale(1.1);
}
.full-menu .menu a span.text {
margin-left: 25px;
/*opacity: .7;*/
}
.full-menu .menu a:hover span.text {
/*margin-left: 30px;*/
transform: translateX(5px);
transition-delay: 0s;
}
/*Анимация меню*/
.menu a:nth-child(1) span { transition: all .5s .1s, opacity .5s 0s, transform .5s 0s; }
.menu a:nth-child(2) span { transition: all .5s .15s, opacity .5s 0s, transform .5s 0s; }
.menu a:nth-child(3) span { transition: all .5s .2s, opacity .5s 0s, transform .5s 0s; }
.menu a:nth-child(4) span { transition: all .5s .25s, opacity .5s 0s, transform .5s 0s; }
$(function(){
$('.box-menu .wrapper').on('click', function(){
$('.box-menu').toggleClass('full-menu');
$('.hamburger').toggleClass('active');
});
$('a').on('click', function(){
$(this).siblings('a').removeClass('active');
$(this).addClass('active');
});
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.