摘要:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>三級下拉菜單</title> <script type="text/javascript" src="jquery-3.3.1.min.js"&g
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>三級下拉菜單</title>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<style type="text/css">
*{margin: 0px;padding: 0px;}
.menu { width: 800px;height: 35px;margin: 0px auto;background: #000; margin-top: 20px;color: #fff; 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;border-right: 1px solid #ccc;cursor: pointer;}
.twobox li {width: 100px;height: 30px;line-height: 30px;background: #2D2D2D;color: #A9A9A9; font-size: 14px;position: relative;border:0px;}
.twobox li:hover {background: #000;color: #fff;}
.three {position: absolute; top: 0px;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>
<div class="menu">
<ul class="one">
<li>首 頁</li>
<li>產(chǎn) 品
<ul class="twobox">
<li>產(chǎn)品1</li>
<li class="two">產(chǎn)品2
<ul class="three">
<li>產(chǎn)品1.1</li>
<li>產(chǎn)品1.2</li>
<li>產(chǎn)品1.3</li>
<li>產(chǎn)品1.4</li>
</ul>
</li>
<li class="two">產(chǎn)品3
<ul class="three">
<li>產(chǎn)品3.1</li>
<li>產(chǎn)品3.2</li>
<li>產(chǎn)品3.3</li>
<li>產(chǎn)品3.4</li>
</ul>
</li>
<li>產(chǎn)品4</li>
</ul>
</li>
<li>公司新聞
<ul class="twobox">
<li>公司新聞1</li>
<li class="two">公司新聞2
<ul class="three">
<li>公司新聞1.1</li>
<li>公司新聞1.2</li>
<li>公司新聞1.3</li>
</ul>
</li>
<li>公司新聞3</li>
<li>公司新聞4</li>
</ul>
</li>
<li>行業(yè)新聞</li>
<li>聯(lián)系我們</li>
</ul>
</div>
</body>
</html>
批改老師:西門大官人批改時間:2019-04-09 09:42:04
老師總結(jié):代碼最好自己寫,不要去復(fù)制粘貼課件代碼,沒有意思