Reputation: 5
I have this navbar. It works great in regular screen width, but when collapsed, the mobile navbar button doesn't work. I've tried to find any unclosed divs and other issues but can't identify any. Thanks in advance for any help! Apologies for the beginner question
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
<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="navbar-brand" href="#">
<div class="text-center">
<a href="http://localhost:3000/"><img alt="nav" src="/assets/navbar.png" /></a>
</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<h4>
<ul class="nav navbar-nav navbar-left">
<!-- <li> <a href="/help">Help</a> </li>-->
<li> <a href="/Buy">Buy</a> </li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li> <a href="/new">Search</a> </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">My purchases<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li> <a href="/lebron">My profile</a> </li>
<li class="divider"></li>
<li> <a href="/Bought">Items bought</a> </li>
<li> <a href="/Sold">Items sold</a> </li>
<li class="divider"></li>
<li> <a href="/purchases">Purchase history</a> </li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Settings <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li> <a href="/users/edit">Edit my profile</a> </li>
<li> <a href="/myprofile">Manage my profile</a> </li>
<li class="divider"></li>
<li class="dropdown-header">GOODBYE </li>
<li> <a data-method="delete" href="/users/sign_out" rel="nofollow">Logout</a> </li>
</ul>
</li>
</div><!-- /.navbar-collapse -->
</nav>
</h4>
Upvotes: 0
Views: 256
Reputation: 362270
Clean-up your HTML and it should work fine. There are several missing close tags (/ul
, /div
) and the /h4
is closed at the end.
Upvotes: 3