<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.left {
position: fixed;
left: 0;
top: 0;
20%;
height: 100%;
background-color: darkviolet;
}
.menu {
color: beige;
}
.title {
text-align: center;
padding: 10px 15%;
border: 1px solid red;
}
.items {
background-color: red;
}
.item {
padding: 5px 10px;
border-bottom: 1px solid blue;
}
.hide {
display: none;
}
</style>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<div class="left">
<div class="menu">
<div class="item">
<div class="title">菜单一</div>
<div class="items">
<div class="item">111</div>
<div class="item">222</div>
<div class="item">333</div>
</div>
</div>
<div class="item">
<div class="title">菜单一</div>
<div class="items">
<div class="item">111</div>
<div class="item">222</div>
<div class="item">333</div>
</div>
</div>
<div class="item">
<div class="title">菜单一</div>
<div class="items">
<div class="item">111</div>
<div class="item">222</div>
<div class="item">333</div>
</div>
</div>
</div>
</div>
<script>
$('.title').click(function () {
$(this).next().removeClass('hide').parent().siblings().find('.items').addClass('hide')
})
</script>
</body>
</html>