Answer the question
In order to leave comments, you need to log in
Collapse doesn't collapse after opening it in Bootstrap 5?
I am using Bootstrap 5 to create the site header. When the window becomes narrow, the links collapse and a button appears. When I click on it, the panel expands, but when I click again to collapse, nothing works. jquery and all scripts from bootstrap connected.
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a style="max-width: 25%;" class="navbar-brand" href="#">
<img src="/data/images/logo.png" alt="" class="d-inline-block align-text-top w-100">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="true" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav nav-justified w-100">
<a class="nav-link active" aria-current="page" href="/">Главная</a>
<a class="nav-link" href="#">Форум</a>
<a class="nav-link" href="#">Pricing</a>
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
{% if visitor.isGuest == true %}
<a class="nav-link" href="/login/login">Войти</a>
{% else %}
<a class="nav-link" href='/account'>{{ visitor.getUsername }}</a>
{% endif %}
</div>
</div>
</div>
</nav>
Answer the question
In order to leave comments, you need to log in
Bootstrap 5 does not use jquery. I took the Starter template and inserted your menu code - the burger works
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question