Erich Sterzing Erich Sterzing - 3 months ago 22
CSS Question

Bootstrap Navbar Collapse Button Won't Work in Browser

Apologies as this has been asked a lot, but none of the solutions seem to work for me. When I resize the window my navbar collapses into a nice button, but if I click on it nothing drops down. Added

js
and
jquery
into
<head>
as most solutions say but still no luck. Any quick solutions? http://codepen.io/chiggory/pen/qNwLWq

HTML:

<head>
<title>Test</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="size.css" media="screen" />
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
</head>

<body>
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li class="active"><a href="http://www.thea21campaign.org">A21</a></li>
<li class="active"><a href="http://bvhope.blogspot.com">Blog</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="learn-more.html">Learn More</a></li>
<li class="active"><a href="contact-us.html">Contact Us</a></li>
<li class="active"><a href="join-us.html">Calendar of Events</a></li>
</ul>
</div>
</div>
</nav>


CSS:

.navbar-custom {
background-color: #800000;
color: white;
border-radius: 0;
}
.navbar-custom .navbar-nav > li > a {
color: #fff;
}
.navbar-custom .navbar-nav > .active > a,
.navbar-nav > .active > a:hover,
.navbar-nav > .active > a:focus {
color: #ffffff;
background-color: #800000;
}
.navbar-custom .navbar-nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #800000;
}
.navbar-custom .navbar-brand {
color: #eeeeee;
}
.navbar-custom .navbar-toggle {
background-color: #eeeeee;
}
.navbar-custom .icon-bar {
background-color: #800000;
}

Answer

Use

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 

instead of

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
Comments