Recently, I copied and pasted a navigation bar from Bootstrap's documentation available at https://getbootstrap.com/docs/4.3/components/navbar/
After integrating this code into my project, everything seemed to work fine except for one issue. When I resize the browser to a mobile size and click on the hamburger menu, all of my menu items briefly appear and then vanish quickly. Strangely, I have to click the hamburger menu twice for the anchor tags to remain visible. This same behavior occurs with the customized navbar code that I have included below:
Here is the code I used:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<img id="navbarLogo" src="img/Home/Crunchsoft.techSignature.png">
<button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#navbar"
aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbar">
<div id="navbar-items" class="navbar-nav">
<a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
<a class="nav-item nav-link" href="#">Services</a>
<a class="nav-item nav-link" href="#">Contact</a>
<a class="nav-item nav-link" href="#">About</a>
</div>
</div>
</nav>
Furthermore, I've even tried various solutions found on Stack Overflow to resolve this issue, such as:
Bootstrap dropdown disappears after clicking it
Bootstrap 4 Toggle Checkbox within Dropdown menu
Keep Bootstrap dropdown open on click
Unfortunately, none of these solutions have worked for me. To add to the frustration, creating the same navbar in a fiddle seemed to work perfectly fine, but the issue persists within my Blazor project.
https://jsfiddle.net/MaxTaylor/6rftaw3o/1/
Even after trying to isolate the problem by commenting out all stylesheets except for Bootstrap, the issue remains unresolved. I am utilizing Blazor in my .AspNetCore project, and strangely enough, the same code seems to work flawlessly in Visual Studio Code but not in my Blazor project.