导航栏菜单切换上的Bootstrap按钮

时间:2016-03-29 09:51:18

标签: twitter-bootstrap hamburger-menu

<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container-fluid">
    <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 class="icon-bar" />
        <span class="icon-bar" />
      </button> <a class="navbar-brand" href="#">QA</a>
      <button type="button" class="btn btn-default navbar-btn">Sign in</button>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active">
          <a href="#">About<span class="sr-only">(current)</span></a>
        </li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Menu<span class="caret"/></a>
          <ul class="dropdown-menu">
            <li>
              <a href="#">Action</a>
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

我的问题如下: 是否可以在Bootstrap中使用导航栏中的按钮 切换菜单作为链接而不是按钮? 让我们说用户从桌面到移动分辨率,他点击汉堡包菜单,显示“登录”链接,但不再显示按钮

enter image description here

1 个答案:

答案 0 :(得分:0)

hidden-xs课程添加到导航栏中的按钮

<button type="button" class="btn btn-default navbar-btn hidden-xs">Sign in</button>

在菜单的某处添加一个类visible-xs的菜单项

<li class="visible-xs"><a href="#">Sign In</a></li>