Bootstrap导航条⿏标悬停下拉菜单
Bootstrap的导航条下拉菜单为了适应移动设备没有⿏标hover的状态,都是点击弹出下拉菜单,为了适应⼀般⽹站使⽤,我稍作了⼀些修改,⿏标hover时就弹出⼆级菜单。
效果图:
CSS修改:
<style type="text/css">
.navbar .nav > li .dropdown-menu {
margin: 0;
}
.navbar .nav > li:hover .dropdown-menu {
display: block;
}
</style>
实例源码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bootstrap导航条⿏标悬停下拉菜单</title>
<link id="bootstrap_221" rel="stylesheet" type="text/css" class="library" href="apps.bdimg/libs/bootstrap/3.3.4/css/bootstrap.min.css">
<script id="jquery_172" type="text/javascript" class="library" src="apps.bdimg/libs/jquery/1.9.1/jquery.min.js"></script>
<script id="bootstrap_221" type="text/javascript" class="library" src="apps.bdimg/libs/boot
strap/3.3.4/js/bootstrap.min.js"></script>
<style type="text/css">
.navbar .nav > li .dropdown-menu {
margin: 0;
}
.navbar .nav > li:hover .dropdown-menu {
display: block;
}
</style>
</head>
<body>
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<ul class="nav nav-pills">
<li class="active"><a href="#">Home</a></li>
<li class="dropdown"><a href="#">SVN<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">sub SVN1</a></li>
<li><a href="#">sub SVN2</a></li>
</ul>
</li>
<li><a href="#">iOS</a></li>
<li><a href="#">VB.Net</a></li>
<li class="dropdown"><a href="#">Java<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">sub Java1</a></li>
<li><a href="#">sub Java2</a></li>
</ul>
</li>
<li><a href="#">PHP</a></li>
</ul>
html导航源码</div>
</div>
</div>
</body>
</html>
以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。