左侧菜单栏
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<style>
#d1{
float: left;
20%;
}
.hide{
display: none;
}
.c2{
background: gray;
text-align: center;
}
.cc{
background: black;
color: white;
tab-size: 20px;
text-align: center;
}
</style>
</head>
<body>
<div id = "d1">
<div>
<div class="cc">菜单一</div>
<div class="c1 hide">
<div class="c2">111</div>
<div class="c2">222</div>
<div class="c2">333</div>
</div>
</div>
<div>
<div class="cc">菜单二</div>
<div class="c1 hide">
<div class="c2">111</div>
<div class="c2">222</div>
<div class="c2">333</div>
</div>
</div>
<div>
<div class="cc">菜单三</div>
<div class="c1 hide">
<div class="c2">111</div>
<div class="c2">222</div>
<div class="c2">333</div>
</div>
</div>
</div>
<script>
$(".cc").on("click",function () {
// alert(123);
// $(this).parent().siblings().find(".c1").addClass("hide");
// $(this).next().removeClass("hide");
$(this).next().toggleClass("hide").parent().siblings().find(".c1").addClass("hide");
})
</script>
</body>
</html>