Bootstrap Tutorial - Create Expander Menu








The following code shows how to create Expander Menu.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-2.0.2.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/dist/css/bootstrap.css">
<script type='text/javascript'
  src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
</head><!--from ww  w.j a  va  2s.c  o  m-->
<body>
  <div class="navbar navbar-inverse">
    <div class="container">
      <!-- Header -->
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse"
          data-target=".navbar-collapse">
          <span class="icon-bar"></span> <span class="icon-bar"></span> <span
            class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">Bootstrap 3.0 Skeleton</a>
      </div>
      <!-- Navbar Links -->
      <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav">
          <li><a href="#" data-toggle="collapse" data-target="#demo">
              Directory <span class="caret"></span>
          </a></li>
          <li><a href="#about">About</a></li>
          <li><a href="#contact">Contact</a></li>
        </ul>
      </div>
    </div>
  </div>
  <div id="demo" class="collapse">
    <div class="row">
      <div class="col-xs-3">
        <a href="">Link 1</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 2</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 3</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 1</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 2</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 3</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 1</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 2</a>
      </div>
      <div class="col-xs-3">
        <a href="">Link 3</a>
      </div>
    </div>
  </div>
  <h2>Page Content</h2>
  <!-- Post Info -->
  <div
    style='position: fixed; bottom: 0; left: 0; background: lightgray; width: 100%;'>
    About This SO Question: <a
      href='http://stackoverflow.com/q/24640251/1366033'>Bootstrap and
      expanding menu</a><br /> Fork This Skeleton Here: <a
      href='http://jsfiddle.net/KyleMit/kcpma/'>Bootstrap 3.0 Skeleton</a><br />
    <div>
</body>
</html>

Click to view the demo