演示地址:http://www.corange.cn/demo/3834/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>弹出菜单</title>
<script type="text/javascript" src="../jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
li{
list-style: none;
margin-left: 18px;
display: none;
}
ul{
/*将ul变成手形状*/
cursor: pointer;
}
a:LINK {
text-decoration: none;
}
-->
</style>
</head>
<body>
<ul>
<a href="#">我是菜单一</a>
<li>子菜单1</li>
<li>子菜单2</li>
</ul>
<ul>
<a href="#">我是菜单二</a>
<li>子菜单1</li>
<li>子菜单2</li>
</ul>
</body>
</html>
<script>
/*点击主菜单按钮,显示出来子菜单的东西*/
//在页面装载的时候,给所有ul注册onclick事件
$(function(){
$("a").click(function(){
//当前的ul节点为$(this)
var list = $(this).parent().children("li");
list.toggle("slow");
})
});
</script>
原文地址:http://www.corange.cn/archives/2012/05/3834.html
jQuery实现淡入淡出的可展开级联菜单
最新推荐文章于 2025-06-21 21:46:24 发布