bootstrap 3 navbar collapse button not working
I did some modification in navbar but now the toggle button is not responding on click.
Below is my code. Where I am wrong ??
You need to change in this markup
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar collapse">
Reason : The value of
data-target is a any class name of the associated nav div. In this case it is
<div class="collapse navbar-collapse"> <-- Look at here <ul class="nav navbar-nav navbar-right"> ..... </div>
Originally I had bootstrap.min.js loading BEFORE jquery.min.js. In this state, the menu would not expand when clicking on the menu icon.
Both scripts are located at the bottom of the page, just before the tag.
Both scripts are hosted on CDNs, not locally hosted.
If you’re pretty sure your code is correct, give this a try.
<body> you should have two
<script src="https://code.jquery.com/jquery-2.1.3.js"></script> <script src="js/bootstrap.js"></script>
Well i had the same problem what when i added the following code within the tag
my problem fixed :
<head> <meta name="viewport" content="width=device-width , initial-scale=1" /> </head>
I hope this can help you guys!
It happened with me, I used jquery.min.js file that downloaded from bootstrap site
it is not working, I tried same page with other jquery.min.js file it worked fine so if you face this problem try to reference other jquery.min.js file in your page and try again
Just my 2 cents, had:
at the end of body, wasn’t working, had to add
crossorigin="anonymous" and now it’s working, Bootstrap version 3.3.6. …