我有很多列表的导航栏。我想在移动的设备上使用下拉菜单和togler。问题是当导航栏被切换到下拉菜单后,触摸将关闭整个togler。
<nav class="navbar navbar-expand-xl navbar-light sticky-top py-3 d-block" data-navbar-on-scroll="data-navbar-on-scroll">
<div class="container"><a class="navbar-brand" href="index.html"><img src="assets/img/gallery/logo-n.png" height="45" alt="logo" /></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon">
</span></button>
<div class="collapse navbar-collapse border-top border-lg-0 mt-4 mt-lg-0" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto pt-2 pt-lg-0 font-base">
<li class="nav-item px-2"><a class="nav-link active" aria-current="page" href="index.html">Domů</a></li>
<li class="nav-item dropdown zakldropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Základní škola
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">Chrakteristika ZŠ</a></li>
<li><a class="dropdown-item" href="#">Organizace školního roku</a></li>
<li><a class="dropdown-item" href="#">Školská rada</a></li>
</ul>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="web-development.html">Mateřská škola</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">Jídelna</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">EKOškola MŠ a ZŠ</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">Družina</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">Málinka z. s.</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">Dokumenty</a></li>
<li class="nav-item px-2"><a class="nav-link" aria-current="page" href="user-research.html">Kontakty</a></li>
</ul>
</div>
</div>
</div>
</nav>
2条答案
按热度按时间mi7gmzs61#
我曾经遇到过同样的问题。在我的例子中,我没有在代码中添加下面这行代码
如果您有这段代码,请确保将这部分代码注解掉
确保您拥有他们推荐的模板:入门模板
https://getbootstrap.com/docs/5.0/getting-started/introduction/
wfveoks02#
我检查它是否工作,但您忘记关闭标签