I am trying to use bootstrap for making a responsive horizontal hamburger menu. My main problem that with the current approach the hamburger toggle has a 100% width and the animation is vertical instead of horizontal. Is there a bootstrap solution for this or do I have to rewrite the whole thing with plain css?
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<style>
* {
font-family: Arial, Helvetica, sans-serif;
}
.dropdown.language:hover > .dropdown-menu, .dropdown.language.open > .dropdown-menu {
display: block;
}
.nav.main-menu .nav-link:hover {
background-color: #0d6efd;
color:#ffffff;
transition: all 800ms ease-out;
-webkit-transition: all 800ms ease-out;
-ms-transition: all 800ms ease-out;
-o-transition: all 800ms ease-out;
-ms-transition: all 800ms ease-out;
}
html {
font-size: calc(0.5em + 0.5vw);
}
* {
border: 1px solid black;
}
</style>
<header class="d-flex flex-wrap justify-content-center py-3 mb-0 px-5 border-bottom sticky-top bg-white">
<a href="#" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
<img src="logo.jpg" width="32" height="32" />
<span class="fs-4 px-3 text-primary d-none d-lg-inline">Company Name</span>
</a>
<nav class="navbar navbar-expand-sm navbar-dark">
<div class="collapse navbar-collapse" id="n_bar">
<ul class="nav nav-pills fs-5 align-items-center main-menu">
<li class="nav-item"><a href="#" class="nav-link text-uppercase active">Home</a></li>
<li class="nav-item"><a href="#" class="nav-link text-uppercase">Products</a></li>
<li class="nav-item"><a href="#" class="nav-link text-uppercase">Factories</a></li>
<li class="nav-item"><a href="#" class="nav-link text-uppercase">About us</a></li>
<li class="nav-item"><a href="#" class="nav-link text-uppercase">Contacts</a></li>
</ul>
</div>
<button class="navbar-toggler ms-auto" type="button" data-bs-toggle="collapse" data-bs-target="#n_bar" aria-controls="navbarNavAltMarkup" aria-label="Toggle navigation">
<span class="navbar-toggler-icon" style="background-image: url(images/bars.svg)" alt="bars" text="bars"></span>
</button>
</nav>
<ul class="nav nav-pills align-items-center mx-2">
<li class="nav-item">
<img src="images/globe.svg" width="24" height="24" />
</li>
<li class="nav-item dropdown language">
<a class="nav-link px-2 dropdown-toggle" href="#" role="button">
<img src="images/en.jpg" alt="en" title="en" />
<span class="px-1">English</span>
</a>
<div class="dropdown-menu">
<a class="nav-link dropdown-item px-3" href="/hu">
<img src="images/hu.jpg" alt="hu" title="hu">
<span class="px-1">Hungarian</span>
</a>
<a class="nav-link dropdown-item px-3" href="/ro">
<img src="images/ro.jpg" alt="ro" title="ro">
<span class="px-1">Romanian</span>
</a>
</div>
</li>
</ul>
</header>