tab切换,.down .box的时候siblings 去掉同类类名没有效果
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title> 效果测试 </title>
<script src="https://code.jquery.com/jquery-1.7.2.js"></script>
</head>
<body>
<style type="text/css">
.tone{ }
.tone li{display: inline-block;padding:10px;margin: 0 10px;background:#ddd;}
.tone li.active{background:#f60}
.down{ }
.down .box{padding:10px;margin-top: 10px;background:#f8f8f8;}
.down .box.on{background: #f60;}
</style>
<ul class="tone">
<li class="active">11</li>
<li>22</li>
</ul>
<div class="down">
<div class="box on">11</div>
<div class="box">22</div>
</div>
<script>
$(".tone li").click(function () {
$(this).addClass("active").siblings().removeClass('active');
$(this).next(".box").addClass("on").siblings().removeClass('on');
})
</script>
</body>
</html>