我正在Ruby on Rails 5项目中使用Bootstrap 4,并且显示后导航不会隐藏。在适当的断点处,单击事件将下拉导航菜单,但是再次单击则无济于事。菜单保持放置状态。我已经在Chrome中进行了检查,虽然没有引发任何错误,但导航(div.collapse.navbar-collapse#navigation)在应用后并未删除“ show”类。 aria-expanded="true"
也停留在按钮上。
<nav class="navbar navbar-expand-xl navbar-light">
<%= link_to(root_path, class: "navbar-brand") do %>
<% if current_page?(root_path) %>
<%= inline_svg "caples_logo_cir.svg", size: "60", id: "welcome-logo", class: "d-inline-block align-middle", nocomment: true, preserve_aspect_ratio: 'xMaxYMax meet', data: {alt: "Caples Web Design logo"} %>
<% else %>
<%= inline_svg "caples_logo_cir.svg", size: "60", id: "logo", class: "d-inline-block align-middle", nocomment: true, preserve_aspect_ratio: 'xMaxYMax meet', data: {alt: "Caples Web Design logo"} %>
<% end %>
<span class="brand-title align-middle">Caples Web Design</span>
<% end %>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navigation">
<div class="navbar-nav ml-auto">
<%= link_to "About", about_path, class: "nav-item nav-link" %>
<%= link_to "Contact", contact_path, class: "nav-item nav-link" %>
</div>
</div>
</nav>
有人可以帮助我确定这个问题吗?