Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 Navbar toggle - collapses but button does not appear

I don't know what I'm doing wrong here but I expect it's something woefully stupid.

I'm using Bootstrap 3 in Umbraco 6.0.5 and I cannot get the toggle to work on resize down - below 770px width the nav collapses but there's no button to toggle it with, or rather something is there, as seen in code and Firebug, but not visible, in Chrome and Firefox (haven't tried IE).

There's a fiddle and the code below. I'm using http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js, http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js and http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css in the fiddle.

<nav class="navbar">
  <div class="container-fluid">
    <div class="navbar-header">

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
        <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"#">reech</a>  
    </div>

    <div class="collapse navbar-collapse" id="nav-collapse">
      <ul class="nav navbar-nav">
        <li><a href="/" class="selected">Home</a></li>
        <li class=" dropdown">
          <a href="/what-is-reech.aspx" class=" dropdown-toggle" data-hover="dropdown" rel="">What is reech? <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="/what-is-reech/about-this-site.aspx" rel="">About this site</a></li>
          </ul>
        </li>
        <li class=" dropdown">
        </li>
        <li><a href="/key-reech-projects.aspx" class="" rel="">Key reech projects</a></li> 
        <li class=" dropdown">
        </li>
        <li><a href="/technologies.aspx" class="" rel="">Technologies</a></li> 
        <li class=" dropdown">
        </li>
        <li><a href="/complementary-activities.aspx" class="" rel="">Complementary Activities</a></li> 
        <li class=" dropdown">
          <a href="/news.aspx" class=" dropdown-toggle" data-hover="dropdown" rel="">News <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="/news/merseyside-collective-switching-scheme-launched.aspx" rel="">Merseyside collective switching scheme launched</a></li>
            <li><a href="/news/reech-scoops-top-award.aspx" rel="">reech scoops top award</a></li>
            <li><a href="/news/reech-award-nomination.aspx" rel="">reech award nomination</a></li>
            <li><a href="/news/green-deal-and-energy-company-obligation-(eco)-september-2013-statistics.aspx" rel="">Green Deal and Energy Company Obligation (ECO) September 2013 Statistics</a></li>
            <li><a href="/news/energy-switching-scheme.aspx" rel="">Energy Switching Scheme</a></li>
            <li><a href="/news/project-reeches-new-milestone.aspx" rel="">Project &#39;reeches&#39; new milestone</a></li>
            <li><a href="/news/firms-sign-up-for-new-opportunities.aspx" rel="">Firms sign up for new opportunities</a></li>
            <li><a href="/news/14-new-jobs-created-for-merseyside-residents.aspx" rel="">14 new jobs created for Merseyside residents</a></li>
            <li><a href="/news/reeching-out-to-low-carbon-and-green-energy-sector.aspx" rel="">&#39;reeching&#39; out to Low Carbon and Green Energy Sector</a></li>
          </ul>
        </li>
        <li class=" dropdown">
        </li>
        <li><a href="/reech-into-business.aspx" class="" rel="">reech into business</a></li> 
        <li class=" dropdown">
          <a href="/reech-partners.aspx" class=" dropdown-toggle" data-hover="dropdown" rel="">reech partners <b class="caret"></b></a>
          <ul class="dropdown-menu">
            <li><a href="/reech-partners/reech-steering-group.aspx" rel="">reech Steering Group</a></li>
          </ul>
        </li>

      </ul>
    </div><!--close navbar-collapse-->
  </div><!--close container-->
</nav><!--Close nav-->

Update - so, I tried altering the data-target (and have altered the fiddle) to #main-nav and the id to main-nav, no joy. The I tried putting a dash character in the button > span element, and it works. That is, the dashes display, and I can toggle the menu. But where are the icon bars?

  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-nav">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar">-</span>
    <span class="icon-bar">-</span>
    <span class="icon-bar">-</span>
  </button>
like image 572
kelpie Avatar asked Feb 12 '14 16:02

kelpie


2 Answers

And change <nav class="navbar"> to <nav class="navbar navbar-default">

like image 161
Fven Avatar answered Oct 11 '22 23:10

Fven


Bootstrap - the toggle button will not show in mobile view

FIX: Make these changes at: bootstrap.min.css

This fixes the outer border of the Toggle Button

.navbar-toggle
{
    position:relative;
    float:right;
    padding:9px 10px;
    margin-top:8px;
    margin-right:15px;
    margin-bottom:8px;
    background-color:transparent;
    background-image:none;
    border-radius:4px
}

Add

border:1px solid #444;

(change color code to match your design)

.navbar-toggle
{
    position:relative;
    float:right;
    padding:9px 10px;
    margin-top:8px;
    margin-right:15px;
    margin-bottom:8px;
    background-color:transparent;
    background-image:none;
    border:1px solid #444;          /* added line */
    border-radius:4px
}

This fixes the horizontal lines of the Toggle Button

.icon-bar
{
    display:block;
    width:22px;
    height:2px;
    border-radius:1px;
}

Add

border:1px solid #444;

(change color code to match your design)

.icon-bar
{
    display:block;
    width:22px;
    height:2px;
    border-radius:1px;
    border:1px solid #444;
}
like image 8
Gjergji Kokushta Avatar answered Oct 11 '22 23:10

Gjergji Kokushta