WordPress企业主题定制/开发/优化

很酷的伸缩导航菜单

首页 » 精选JS » 很酷的伸缩导航菜单

<!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" />
<style type="text/css">
*{margin:0; padding:0;}
body{ font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666;}
#box{width:200px; border:1px solid #ccc;}
.title{ font-size:12px; padding-left:3px; height:20px; border-bottom:1px solid #fff; background:#000; line-height:20px; color:#FFF; cursor:pointer;}
.content{ padding:5px; height:150px;}
</style>
<script type="text/javascript">
function flexMenu(id)
{
var $id = document.getElementById(id);
var titleList = $id.getElementsByTagName('h2');
var contentList = $id.getElementsByTagName('div');
titleList[titleList.length-1].style.border = 'none';
for(var i=0;i<titleList.length;i++)
{
titleList[i].onclick = function()
{
for(var a=0;a<contentList.length;a++)
{
contentList[a].style.display = 'none';
}
if(this.nextSibling.nodeType=='3')
{
this.nextSibling.nextSibling.style.display = '';
}else
{
this.nextSibling.style.display = '';
}
}
}
}
window.onload = function(){ flexMenu('box')}
</script>
<title>很酷的伸缩导航菜单</title>
</head>
<body>
<div id="box">
<h2>站长特效</h2>
<div ><a href="http://www.moerdao.com">特效频道子菜单</a></div>
<h2>网页特效</h2>
<div style="display:none;"><a href="http://www.moerdao.com">网页特效子菜单</a></div>
<h2>广告代码</h2>

<div style="display:none;"><a href="https://www.3code.cn">广告代码子菜单</a></div>
</div>
</body>
</html>

分类与标签:

精选JS

, ,

相关项目

  • WordPress外贸企业主题

  • 最近更新

  • 热门标签