gpt4 book ai didi

javascript - 使 Bootstrap 的 YAMM 在悬停时打开

转载 作者:数据小太阳 更新时间:2023-10-29 03:48:00 26 4
gpt4 key购买 nike

我正在使用 YAMM 为 Bootstrap 创建一个大型菜单,但我不知道如何使菜单在鼠标悬停/悬停时出现。目前它仅在点击时出现。

github demo

jsFiddle

<div class="container">

<div class="navbar yamm">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target="#nav1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#"> Yamm Megamenu </a>
<div class="nav-collapse collapse" id="nav1">
<ul class="nav">
<!-- Classic list -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> List <b class="caret"></b> </a>
<ul class="dropdown-menu">
<li>
<!-- Content container to add padding -->
<div class="yamm-content">
<ul class="span2 unstyled">
<li><p><strong>Section Title</strong></p></li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
</ul>
<ul class="span2 unstyled">
<li><p><strong>Links Title</strong></p></li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</ul>
<ul class="span2 unstyled">
<li><p><strong>Section Title</strong></p></li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
List Item
</ul>
<ul class="span2 unstyled">
<li><p><strong>Section Title</strong></p></li>
<li>
List Item
</li>
<li>
List Item
</li>
<li>
<ul>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
<li>
<a href="#"> Link Item </a>
</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</li>
<!-- Accordion demo -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> Accordion <b class="caret"></b> </a>
<ul class="dropdown-menu">
<li>
<div class="yamm-content">
<div class="row-fluid">
<div id="accordion2" class="accordion span6">
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseOne" data-parent="#accordion2" data-toggle="collapse" class="accordion-toggle collapsed"> Collapsible Group Item #1 </a>
</div>
<div class="accordion-body collapse" id="collapseOne" style="height: 0px;">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseTwo" data-parent="#accordion2" data-toggle="collapse" class="accordion-toggle"> Collapsible Group Item #2 </a>
</div>
<div class="accordion-body collapse" id="collapseTwo">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseThree" data-parent="#accordion2" data-toggle="collapse" class="accordion-toggle"> Collapsible Group Item #3 </a>
</div>
<div class="accordion-body collapse" id="collapseThree">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
<div id="accordion3" class="accordion span6">
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseOne1" data-parent="#accordion3" data-toggle="collapse" class="accordion-toggle collapsed"> Collapsible Group Item #1 </a>
</div>
<div class="accordion-body collapse" id="collapseOne1" style="height: 0px;">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseTwo1" data-parent="#accordion3" data-toggle="collapse" class="accordion-toggle"> Collapsible Group Item #2 </a>
</div>
<div class="accordion-body collapse" id="collapseTwo1">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a href="#collapseThree1" data-parent="#accordion3" data-toggle="collapse" class="accordion-toggle"> Collapsible Group Item #3 </a>
</div>
<div class="accordion-body collapse" id="collapseThree1">
<div class="accordion-inner">
Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
<!-- Classic dropdown -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> Classic <b class="caret"></b> </a><!-- Classic Dropdown -->
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
<li>
<a tabindex="-1" href="#"> Action </a>
</li>
<li>
<a tabindex="-1" href="#"> Another action </a>
</li>
<li>
<a tabindex="-1" href="#"> Something else here </a>
</li>
<li class="divider"></li>
<li>
<a tabindex="-1" href="#"> Separated link </a>
</li>
</ul>
</li>
<!-- Pictures -->
<li class="dropdown yamm-fullwidth">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> Pictures <b class="caret"></b> </a>
<ul class="dropdown-menu">
<li>
<div class="yamm-content">
<!-- thumbnails needs a row-fluid to make span fluid -->
<div class="row-fluid">
<ul class="thumbnails">
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
<li class="span2">
<a class="thumbnail" href="#"> <img alt="150x190" data-src="holder.js/150x90"> </a>
</li>
</ul>
</div>
</div>
</li>
</ul>
</li>

</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>

最佳答案

当特定的 li 悬停时,您需要制作 display: block

将其添加到您的 CSS 代码中

ul.nav li.dropdown:hover > ul.dropdown-menu {
display: block;
}

关于javascript - 使 Bootstrap 的 YAMM 在悬停时打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22458901/

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