console
$(function(){
$('.nav li').hover(function() {
$(this).find('.sub').stop().slideDown(300);
},
function() {
$(this).find('.sub').stop().slideUp(300);
});
})
<link href="https://cdn.bootcss.com/minireset.css/0.0.2/minireset.min.css"
rel="stylesheet">
<div class="header">
<div class="wp">
<ul class="nav">
<li class="on">
<a href="/" class="v1">
首页
</a>
</li>
<li>
<a href="" class="v1">
关于我们
</a>
<div class="sub">
<a href="">
公司简介
</a>
<a href="">
组织架构
</a>
<a href="">
客户案例
</a>
<a href="">
联系我们
</a>
</div>
</li>
<li>
<a href="" class="v1">
产品与服务
</a>
<div class="sub">
<a href="/index.php?c=article&a=type&tid=62">
线上健康管理
</a>
<a href="/index.php?c=article&a=type&tid=63">
社区智能健康中心
</a>
<a href="/index.php?c=article&a=type&tid=64">
线下活动
</a>
<a href="/index.php?c=article&a=type&tid=65">
健康指南
</a>
</div>
</li>
<li>
<a href="/index.php?c=article&a=type&tid=66" class="v1">
新闻报道
</a>
<div class="sub">
<a href="/index.php?c=article&a=type&tid=66">
公司新闻
</a>
<a href="/index.php?c=article&a=type&tid=71">
行业新闻
</a>
</div>
</li>
<li>
<a href="/index.php?c=article&a=type&tid=67" class="v1">
加入我们
</a>
<div class="sub">
<a href="/index.php?c=article&a=type&tid=67">
人才招聘
</a>
<a href="/index.php?c=article&a=type&tid=68">
企业责任
</a>
</div>
</li>
</ul>
</div>
</div>
<div style="height:2000px;padding-top:100px;">
测试滚动的时候导航高度会有变化
</div>
body {
font-family: "微软雅黑";
}
a {
color: #000;
text-decoration: none;
}
.wp {
margin: 0 auto;
width: 100%;
max-width: 1200px
}
.nav {
height: 50px;
line-height: 50px;
}
.nav li {
float: left;
position: relative;
height: 50px;
}
.nav li a.v1 {
font-weight: 700;
display: block;
width: 110px;
text-align: center;
margin: 0 10px;
}
.nav li.on>a {
background-color: #757cbb;
color: #fff!important
}
.nav li.ok>a {
color: #757cbb;
background-position: center 80px;
}
.min .nav li.ok a.v1 {
background-position: center 40px;
}
.nav .sub {
position: absolute;
left:0;
width:180px;
background:#757cbb;
top: 50px;
z-index: 100;
display:none;
}
.nav .sub a {
line-height: 30px;
font-size: 14px;
color: #fff;
display: block;
padding: 0 15px
}
.nav .sub a:hover {
color: #757cbb
}