获取按钮以在折叠的导航栏中显示

时间:2015-11-14 02:29:42

标签: jquery html twitter-bootstrap navbar collapsable

这是我第一次尝试建立一个网站。到目前为止,我已经设置了导航栏,但是当我将屏幕缩小时,我想确保正确的元素折叠成下拉按钮。到目前为止,我已经有了这个按钮,即使光标感觉它需要做一些按钮所应该的东西,按钮也不会出现。



<nav class="navbar-wrapper">
    <div class="container-fluid">
        <div class="navbar-header"> <!--I am looking to organize these elements on right hand side of page-->
            <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="index.html">Sash Illustration</a
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="index.html">Home</a></li>
                <!--<div id="navBar">-->
                <li><a href="about.html">About Me</a></li>
                <li><a href="contact.html">Contact</a></li>
            </ul>
        </div>
    </div>
</nav>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

按钮就是需要一些使用CSS的颜色

&#13;
&#13;
.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 #333333;
  border-radius: 4px;
}
&#13;
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar-wrapper">
  <div class="container-fluid">
    <div class="navbar-header">
      <!--I am looking to organize these elements on right hand side of page-->
      <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="index.html">Sash Illustration</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="index.html">Home</a>
        </li>
        <!--<div id="navBar">-->
        <li><a href="about.html">About Me</a>
        </li>
        <li><a href="contact.html">Contact</a>
        </li>
      </ul>
    </div>
  </div>
</nav>
&#13;
&#13;
&#13;