Bootstrap 导航栏菜单切换按钮
Bootstrap button on navbar menu toggle
<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 中使用导航栏中的按钮
将菜单切换为 link 而不是按钮?
假设用户从桌面转到移动分辨率,他单击汉堡菜单,显示 link 'Sign In' 但不再作为按钮显示
将 hidden-xs
class 添加到导航栏中的按钮
<button type="button" class="btn btn-default navbar-btn hidden-xs">Sign in</button>
在您的菜单中的某处添加带有 class visible-xs
的菜单项
<li class="visible-xs"><a href="#">Sign In</a></li>
<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 中使用导航栏中的按钮 将菜单切换为 link 而不是按钮? 假设用户从桌面转到移动分辨率,他单击汉堡菜单,显示 link 'Sign In' 但不再作为按钮显示
将 hidden-xs
class 添加到导航栏中的按钮
<button type="button" class="btn btn-default navbar-btn hidden-xs">Sign in</button>
在您的菜单中的某处添加带有 class visible-xs
的菜单项
<li class="visible-xs"><a href="#">Sign In</a></li>