AndrewLeonardi AndrewLeonardi - 1 year ago 288
jQuery Question

Bootstrap hamburger menu not working

For some reason my bootstrap hamburger menu is acting up. The menu shows up just fine when on a small screen but the menu does not expand when clicked.

I went ahead and added the full code to see if that helps.

Here is my code:

<!DOCTYPE html>
<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />

<title> TopMusicFestivals </title>
<script src=""></script>
<link rel= "stylesheet" href="">
<!--Connecting CSS-->
<link rel= "stylesheet" href = "/stylesheets/main.css">

<link rel="stylesheet" href="">

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" href="#collapse1" 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>

<a class="navbar-brand" href="/">TMF</a>
<div id="navbar" class="collapse navbar-collapse" data-target="#collapse1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
<ul class="nav navbar-nav navbar-right">

<!--The if statemnet below along with the currentUser varriable is how we're passing the user name into the navbar-->
<% if(!currentUser){ %>
<li> <a href="/login"> Login </a></li>
<li> <a href="/register"> Sign Up </a></li>
<% } else{ %>
<li> <a href ="#">Signed In As: <%= currentUser.username%> </a></li>
<li> <a href="/logout"> Log Out </a></li>
<% } %>


Answer Source

If the hamberger menu is showing up on smaller screens, but not expanding, it could be that the bootstrap JS and JQuery files are not loading correctly. Just add the following scripts to you code.

<script src=""></script>
<script src=""></script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download