在Twitter Bootstrap中,禁用悬停并允许点击子菜单可以通过以下步骤实现:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Logo</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Services
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Service 1</a>
<a class="dropdown-item" href="#">Service 2</a>
<a class="dropdown-item" href="#">Service 3</a>
</div>
</li>
</ul>
</div>
</nav>
.dropdown:hover .dropdown-menu {
display: none;
}
.dropdown .dropdown-menu {
display: block;
}
<style>
标签内添加。现在,当你在浏览器中打开页面并悬停在"Services"菜单上时,子菜单将不会显示。相反,你需要点击"Services"菜单才能展开子菜单。
推荐的腾讯云相关产品:腾讯云云服务器(CVM)和腾讯云负载均衡(CLB)。
请注意,以上答案仅供参考,具体的产品选择应根据实际需求和情况进行评估。