How can I implement a scroll feature for navbar items in a Bootstrap menu when there are numerous items?
Here is my code:
<nav class="navbar navbar-expand-lg navbar-dark bg-info fixed-top">
<a class="navbar-brand" href="/">Brand name</a>
<a class="btn btn-danger shadow-sm mr-sm-2 text-white" role="button" href="/demo"> Button</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" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
....
</ul>
<a href="/search" class="btn btn-info shadow-sm text-white" role="button">Search</a>
</div>
</nav>
I attempted to solve this by adding the following CSS:
.navbar-collapse { max-height: 100vh; overflow-y: scroll; }
Unfortunately, this resulted in a vertical scrollbar appearing within the navbar as shown here.