Bootstrap Navbar Toggle Button Not Working


Answer :

Demo: http://jsfiddle.net/u1s62Lj8/1/

You need the jQuery and Boostrap Javascript files included in your HTML page for the toggle to work. (Make sure you include jQuery before Bootstrap.)

<html>    <head>        // stylesheets here        <link rel="stylesheet" href=""/>     </head>    <body>       //your html code here        // js scripts here       // note jquery tag has to go before boostrap       <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>       <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>    </body> </html> 

Your code looks great, the only thing i see is that you did not include the collapsed class in your button selector. http://www.bootply.com/cpHugxg2f8 Note: Requires JavaScript plugin If JavaScript is disabled and the viewport is narrow enough that the navbar collapses, it will be impossible to expand the navbar and view the content within the .navbar-collapse.

The responsive navbar requires the collapse plugin to be included in your version of Bootstrap.

<div class="navbar-wrapper">       <div class="container">          <nav class="navbar navbar-inverse navbar-static-top">           <div class="container">             <div class="navbar-header">               <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">                 <span class="sr-only">Toggle navigation</span>                 <span class="icon-bar"></span>                 <span class="icon-bar"></span>                 <span class="icon-bar"></span>               </button>               <a class="navbar-brand" href="#">Project name</a>             </div>             <div id="navbar" class="navbar-collapse collapse">               <ul class="nav navbar-nav">                     <li><a href="">Page 1</a>                     </li>                     <li><a href="">Page 2</a>                     </li>                     <li><a href="">Page 3</a>                     </li>                </ul>             </div>           </div>         </nav>        </div>     </div> 

Remember load jquery before bootstrap js


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?