hover控制div显示隐藏

鼠标移到导航栏中显示底下的DIV,移出隐藏

第1个回答  推荐于2018-05-18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="jquery1.42.min.js" type="text/javascript"></script>
</head>

<body>
<script>
$(function(){
$(".title").hover(function(){
$(".content").show(1000);
},function(){
$(".content").hide(1000);
}
)
})
</script>
<ul class="title">aaaaaaaaaaaaaaaaaaaaaa</ul>
<div class="content" style="display:none;">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
</body>
</html>追问

能否实现 hover显示div 移出div才隐藏

追答

这个代码就是

本回答被提问者和网友采纳
第2个回答  2014-07-23
onmouserover=document.getElementById("showdiv").style.display="none" onmouseout=document.getElementById("showdiv").style.display="hidden"
当然你也可以控制className来显示隐藏