Witajcie,
Jak w temacie. Po kliknięciu hamburgera nic się nie dzieje, nic się nie rozwija. Szukałem możliwych rozwiązań, ale każde z nich nie trafia w sedno problemu. Brak mi już pomysłów. Może ktoś z Was miał podobny problem?
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<meta charset="utf-8">
<link rel= "stylesheet" type="text/css" href="style.css" />
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
</head>
<header>
<div class="logo">LOGO</div>
<nav class="active">
<ul>
<li><a href="#" class="active">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<div class="menu-toggle"><i class="fa fa-bars" aria-hidden="true"></i></div></header>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.menu-toggle').click(function()
{
$('nav').toggleClass('active');
});
});
</script>
<body>
</body>
</html>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
header {
position: absolute;
top:0;
left:0;
padding: 0 100px;
background: #262626;
width: 100%;
box-sizing: border-box;
}
header .logo {
color: #fff;
height: 50px;
line-height: 50px;
font-size: 24px;
float: left;
}
header nav {
float: right;
}
header nav ul {
margin: 0;
padding: 0;
display: flex;
}
header nav ul li {
list-style-type: none;
}
header nav ul li a {
height: 50px;
line-height: 50px;
padding: 0 20px;
color: #fff;
text-decoration: none;
display: block;
}
header nav ul li a:hover,
header nav ul li a.active
{
color: #fff;
background: #2196F3;
}
.menu-toggle {
color: #fff;
float: right;
line-height: 50px;
font-size: 24px;
cursor: pointer;
display: none;
}
@media (max-width: 991px)
{
header {
padding: 0 20px;
}
.menu-toggle {
display: block;
}
header nav {
/*display: none;*/
position: absolute;
width: 100%;
height: calc(100vh - 50px);
background: #333;
top: 50px;
left:0;
transition: 0.5s;
}
header nav.active {
left: 0;
}
header nav ul {
display: block;
text-align: center;
}
header nav ul li a {
border-bottom: 1px solid rgba(0,0,0,.2);
}
}