navLI鼠标滑上显示下拉导航

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>li导航</title>
<style type="text/css">
*{padding: 0;margin: 0;}
#box{ 100%;background: red;height: 50px;margin: 0 auto;position: relative;min- 500px;}
#list{margin: 0 400px;min- 500px;}
#list li{list-style: none;float: left;padding: 10px;background: paleturquoise;cursor: pointer;
}
#hide{ 86px;height: 150px;background: blueviolet;position: absolute;top: 39px;
left: 451px;display: none;}
#hide ul li{list-style: none;text-align: center; 67px;height: 38px; line-height: 38px;}
</style>
<script type="text/javascript" src="js/jquery.js" ></script>

</head>
<body>
<div id="box">
<ul id="list">
<li>首页</li>
<li id="pro">产品列表


</li>
<li>活动介绍</li>
<li>联系我们</li>

</ul>
<div id="hide">
<ul >
<li>首页</li>
<li>表头</li>
<li>首页</li>
<li>首页</li>
</ul>
</div>
</div>

<script type="text/javascript">
$(function(){
var pro = document.getElementById("pro");
var hide = document.getElementById("hide");

pro.onmouseover = function(ev){
var ev = ev || event;
hide.style.display = 'block';
ev.cancelBubble = 'true';

}
hide.onmouseover = function (ev){
var ev = ev || event;
ev.cancelBubble = 'true';
}

document.onmouseover = function (){
hide.style.display = 'none';
}

})
</script>
</body>
</html>

原文地址:https://www.cnblogs.com/qiyc/p/5859423.html