我希望导航栏始终在移动设备上展开,但要像折叠的导航栏正常切换一样垂直显示。由于导航栏始终处于展开状态,因此我也想删除“汉堡包”按钮的可见性。
在桌面上,导航栏应始终展开和水平放置,这已经在我的代码中起作用了。
我认为在导航栏切换器上简单地使用aria-expanded =“ true”应该会起作用,但似乎不起作用。
提琴:https://medium.com/@chantaljustamond/implementing-pickadate-js-on-a-rails-app-c47af58c33af
代码:
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#footerResponsive" aria-controls="footerResponsive" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span><!-- I want to remove this -->
</button>
<div id="footerResponsive" class="collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">item 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">item 2</a>
</li>
</ul>
</div>
</div>
</nav>
答案 0 :(得分:1)
您只需要从collapse
中删除navbar-collapse
类。 (如果您不希望切换开关,则将其删除)
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<div id="footerResponsive" class="navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">item 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">item 2</a>
</li>
</ul>
</div>
</div>
</nav>
答案 1 :(得分:0)
您需要从#footerResponsive button
中删除汉堡包div
和类。
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<div id="footerResponsive">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">item 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">item 2</a>
</li>
</ul>
</div>
</div>
</nav>