Having some trouble toggling the navbar button. It's not working as expected - when I click on it, the toggle background appears and disappears immediately. Here is my code snippet along with a link to the Fiddle file:
https://jsfiddle.net/85uyhbv6/
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark sticky-top bg-custom">
<div class="container-fluid">
<a class="navbar-brand" href="#">Brand</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse text-center" id="navbarSupportedContent">
<ul class="navbar-nav navbar-center">
<li class="nav-item active">
<a class="nav-link" href="#top-img">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#games-tag">Games</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#team-tag">Team</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About Us</a>
</li>
</ul>
</div>
</div>
</nav>
.bg-gray{
background-color: #b8b8b8;
}
.bg-custom{
background-color: #170c37;
}
.navbar-brand{
font-family: roboto-thin;
font-weight: bold;
font-size: 28px;
}
.navbar-dark .navbar-nav .nav-link{
font-family: roboto-thin;
font-weight: 700;
font-size: 16px;
}
.navbar-dark .navbar-nav .nav-item{
margin: 0 15px;
}
.navbar-center{
position: absolute;
left: 50%;
transform: translatex(-50%)
}
I suspect that the issue might be with the positioning of absolute elements, but I'm struggling to center the items correctly without it. Any help would be greatly appreciated.