navLI鼠标滑上显示下拉导航
Posted 江山一族
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了navLI鼠标滑上显示下拉导航相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>li导航</title>
<style type="text/css">
*{padding: 0;margin: 0;}
#box{width: 100%;background: red;height: 50px;margin: 0 auto;position: relative;min-width: 500px;}
#list{margin: 0 400px;min-width: 500px;}
#list li{list-style: none;float: left;padding: 10px;background: paleturquoise;cursor: pointer;
}
#hide{width: 86px;height: 150px;background: blueviolet;position: absolute;top: 39px;
left: 451px;display: none;}
#hide ul li{list-style: none;text-align: center;width: 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>
以上是关于navLI鼠标滑上显示下拉导航的主要内容,如果未能解决你的问题,请参考以下文章