带有动画导航
斜杠大叔2019-04-22 17:41:36233<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>三级下拉导航</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<style type="text/css">
*{margin: 0;padding: 0;}
.menu{
width: 800px;
height:35px;
margin: 0 auto;
background: #000;
color: #fff;
margin-top: 30px;
border:1px solid #ccc;
border-radius: 5px;
}
ul{list-style: none;}
ul li{
width: 100px;
height:35px;
line-height: 35px;
text-align: center;
float: left;
cursor: pointer;
border-right: 1px solid #ccc;
}
.twobox li{
width: 100px;
height: 35px;
line-height: 30px;
background: #2d2d2d;
color: #a9a9a9;
font-size: 14px;
position: relative;
border:0;
}
.twobox li:hover{background: #000;color: #fff;}
.three{
position: absolute;
top: 0;
left: 100px;
}
.three li{
width:99px;
height: 30px;
line-height: 30px;
border:0;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('.twobox').hide()
$('.three').hide()
$('.one>li').mouseover(function(){
$(this).find('.twobox').slideDown(500)
})
$('.one>li').mouseleave(function(){
$(this).find('.twobox').slideUp(500)
})
$('.two').mouseover(function(){
$(this).find('.three').slideDown(500)
})
$('.two').mouseleave(function(){
$(this).find('.three').slideUp(500)
})
})
</script>
</head>
<body>
<script type="text/javascript">
</script>
<div class="menu">
<ul class="one"> <!-- 一级下拉菜单 -->
<li>首页</li>
<li>产品介绍
<ul class="twobox"> <!-- 二级下拉菜单 -->
<li>产品1</li>
<li class="two">产品2
<ul class="three"> <!-- 三级下拉菜单 -->
<li>产品1.11</li>
<li>产品1.11</li>
<li>产品1.11</li>
</ul>
</li>
</ul>
</li>
<li>新闻动态
<ul class="twobox"> <!-- 二级下拉菜单 -->
<li>新闻1</li>
<li class="two">新闻2
<ul class="three"> <!-- 三级下拉菜单 -->
<li>新闻1.11</li>
<li>新闻1.11</li>
<li>新闻1.11</li>
</ul>
</li>
<li>新闻3</li>
<li>新闻4</li>
</ul>
</li>
</ul>
</div>
</body>
</html>