I am rather new to using Bootstrap, and would love for one of you pros out there to show me where I am making my mistake.
What I am trying to accomplish: I am working on a responsive website using Bootstrap. I wish for my navbar to be fixed at the top, and when the web page is reduced to a mobile size, I would like for my navbar to show menu items when pressed.
The problem: While in mobile browser dimensions, the navbar will not show any menu items when pressed. There is no toggle.
What I have tried: I have browsed through other user's StackOverflow questions and comments, in which the majority have said to make sure the "data-toggle" matches up with the id selector following the "collapse navbar-collapse" class.
You will find that these match up. myNavbar is an id selector. Solution does not work.
<div class="container-fluid" id="contentsOfMenu">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class"page-scroll">
<a href="#welcome" id="brandLabel"><img src="images/brainFishIconMenu.png"/></a>
<a class="navbar-brand" href="#welcome" >BrainFish</a>
</div>
</div><!--end of navbar-header--------------------------->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right" id="navLinkColor">
<li class="page-scroll"><a href="#aboutUs">About</a></li>
<li class="page-scroll"><a href="#services">Services</a></li>
<li class="page-scroll"><a href="#approach">Approach</a></li>
<li class="page-scroll"><a href="#contact">Contact</a></li>
</ul>
</div><!--end of myNavBar-->
</div><!--end of contentsOfMenu--------------------->
</nav><!--end of navigation-->
You need to add the CDN's correctly else collapsing and toggling won't work
Order to be followed for adding Bootstrap 4 CDN is:
and a sample template that is to be followed according to bootstrap 4 specifications is :
First make sure you have included bootstrap.js right after jquery script tag.Then check your navbar markup.for example:
And
You might be missing the javascript component of bootstrap. It is required for the menu foldout to work. Or, an exception might have halted Javascript. You can check that in your browsers debugging console.