demo代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
div {
width: 400px;
height: 326px;
margin: 100px auto;
}
ul {
list-style: none;
}
.top {
width: 400px;
height: 26px;
}
.top li {
box-sizing: border-box;
width: 81px;
line-height: 24px;
float: left;
text-align: center;
background: yellow;
border: 1px solid #000;
margin-left: -1px;
cursor: pointer;
}
.bottom {
width: 400px;
height: 300px;
position: relative;
}
.bottom li {
width: 401px;
height: 300px;
background: red;
position: absolute;
top: 0;
left: 0;
border: 1px solid #000;
border-top: 0;
box-sizing: border-box;
font-size: 30px;
text-align: center;
line-height: 300px;
margin-left: -1px;
display: none;
}
.bottom .one {
display: block;
}
</style>
</head>
<body>
<div>
<ul class="top">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<ul class="bottom">
<li class="one">A</li>
<li>B</li>
<li>C</li>
<li>D</li>
<li>E</li>
</ul>
</div>
<script type="text/javascript">
$(".top li").click(function(){
$(this).css("border-botttom",0);
$(".bottom li").eq($(this).index()).css("display","block");
$(".bottom li").eq($(this).index()).siblings().css("display","none");
})
</script>
</body>
</html>