<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
ul li{
list-style: none;
}
h3{
width: 200px;
height: 30px;
background: rosybrown;
}
</style>
</head>
<body>
<ul class="wai">
<li class="ss">
<h3>项目一</h3>
<ul class="nei">
<li>项目二、一</li>
<li>项目二</li>
</ul>
</li>
<li class="ss">
<h3>项目二</h3>
<ul class="nei">
<li>项目二、一</li>
<li>项目二</li>
</ul>
</li>
<li class="ss">
<h3>项目三</h3>
<ul class="nei">
<li>项目二、一</li>
<li>项目二</li>
</ul>
</li>
</ul>
</body>
<script>
$(".ss h3").click(function () {
$(this).siblings("ul").show();
$(this).parents("li").siblings().find("ul").hide();
});
</script>
</html>
折叠面板的思想
最新推荐文章于 2022-05-24 17:42:00 发布