<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>制作Tab面板</title>
</head>
<style type="text/css">
#tab{
margin: 0; list-style: none;
padding: 0 0 31px;
border-bottom: 1px solid #11a3ff;
}
li{
float: left;
background: #BBDDFF;
margin-right: 4px; padding: 5px;
border: 1px solid #11a3ff; height: 20px;
}
.cur{
background-color: #fee;
border-bottom: 1px solid #fee; color: red;
}
div{
clear: left; padding: 10px;
height: 100px; background-color: #Fee;
border: 1px solid #11a3ff;
border-top: none; display: none;
}
.divcur{display: block;}
</style>
<body><script src="jquery-3.4.1.min.js"></script>
<script>
$(function(){
$("#tab li").each(function(index){
$(this).mouseover(function(){
$("div.divcur").removeClass("divcur");
$("li.cur").removeClass("cur");
$("div:eq("+index+")").addClass("divcur");
$("li").eq(index).addClass("cur");
});
});
});
</script>
<ul id="tab">
<li class="cur">课程特色</li>
<li>教学方法</li>
<li>教学效果</li>
</ul>
<div class="divcur">本课程主要特色</div>
<div>教学方法和教学手段</div>
<div>教学效果</div>
</body>
</html>
原文地址:https://www.cnblogs.com/sihuan/p/12091568.html