html>
Documentnav ul {
padding: 0;
list-style: none;
}
nav ul li {
text-decoration: none;
width: 70px;line-height: 50px;
text-align: center;
float: left;
background-color: #000;
color: #fff;
cursor: pointer;}
.gray {background-color: rgba(0,0,0,0.6);}
- 首页
- 实战
- 路径
- 猿问
- 手记
$("nav li").click(function(){
$(this).addClass("gray").siblings().removeClass("gray");
})
$("nav li").click(function(){
$(this).addClass("gray").siblings().removeClass("gray");
})
一句搞定
自己引一个jQuery库就行