Meshredded Meshredded - 6 months ago 9
Javascript Question

bootstrap navbar don't completely open

As you can see in this jsfiddle the navbar doesn't open all the way down. How can I fix this so it does?

<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<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="#">Bienvenue</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

<form class=" form-control navbar-form navbar-left" id="connection_form">
<div class="form-group">
<input type="email" id="email" class="form-control" required placeholder="Email">
<input type="password" id="pass" class="form-control" required placeholder="Mot de Passe">
</div>
<button type="submit" id="connect" class="btn btn-default"><i class="fa fa-spinner fa-spin "></i> Se Connecter</button>
</form>


Thanks.

Answer

You simply need to remove the form-control from the form:

This:

<form class="form-control navbar-form navbar-left">

Should be this:

<form class="navbar-form navbar-left">

Working Example

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css" rel="stylesheet" />
<nav class="navbar navbar-default">
  <div class="container-fluid">

    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <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="#">Bienvenue</a>
    </div>

    <div class="collapse navbar-collapse" id="navbar">
      <form class="navbar-form navbar-left">
        <div class="form-group">
          <input type="email" id="email" class="form-control" required placeholder="Email">
          <input type="password" id="pass" class="form-control" required placeholder="Mot de Passe">
        </div>
        <button type="submit" id="connect" class="btn btn-default">
          <i class="fa fa-spinner fa-spin "></i> Se Connecter
        </button>
      </form>
    </div>

  </div>
</nav>

Comments