gpt4 book ai didi

html - Bootstrap 下拉菜单默认在站点加载时打开

转载 作者:太空狗 更新时间:2023-10-29 16:00:52 26 4
gpt4 key购买 nike

我遇到的问题是,我在使用 Bootstrap 的网站的导航栏内添加了一个下拉菜单,但无法弄清楚为什么在网站打开时下拉菜单会以默认状态打开。我是 Bootstrap 的新手。我附上了下面导航栏的代码:

<div class="navbar navbar-inverse">
<ul class="nav nav-pills pull-right">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle">
<span class="glyphicon glyphicon-list"></span>
</a>
<ul role="menu" class="dropdown-menu">
<li><a>Add New Item</a></li>
<li><a>PC Requests</a></li>
<li><a>Kit Building</a></li>
</ul>
</li>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Audit</a></li>
<li><a href="#">Check-Out</a></li>
<li><a href="#">Check-In</a></li>
</ul>
<h3 class="text-muted"><span class="glyphicon glyphicon-eye-open"></span> Gentex Vision IVMS</h3>
</div>

如有任何帮助,我们将不胜感激!

最佳答案

重点是添加open<li class="dropdown"> .

实际上,它应该是这样的

<div class="navbar navbar-inverse">
<ul class="nav nav-pills pull-right">
<li class="dropdown open">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-list"></span>
</a>
<ul role="menu" class="dropdown-menu">
<li><a>Add New Item</a></li>
<li><a>PC Requests</a></li>
<li><a>Kit Building</a></li>
</ul>
</li>
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Audit</a></li>
<li><a href="#">Check-Out</a></li>
<li><a href="#">Check-In</a></li>
</ul>
<h3 class="text-muted"><span class="glyphicon glyphicon-eye-open"></span> Gentex Vision IVMS</h3>

然后默认打开

最好的问候

关于html - Bootstrap 下拉菜单默认在站点加载时打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24113223/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com