* {
margin:0;
padding:0;
}
.clearfix:after {
height:0;
display:block;
content:'.';
visibility:hidden;
clear:both;
}
ul,li,h1,h2,h3,h4,h5,h6,p,dl,dt,dd,form,label {
display:block;
}
ul {
list-style:none;
}
img {
border:0;
}
.ellipsis {
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
a:link {
text-decoration:none;
outline:none;
}
a:hover {
color:red;
}
a:active {
color:#f90;
}
body {
background:#ffffff;
}
* {
margin:0;
padding:0;
}
.clearfix:after {
height:0;
display:block;
content:'.';
visibility:hidden;
clear:both;
}
ul,li,p,h1,h2,h3,h4,h5,h6,form,label,aside,section,header,footer,dd,dt,dl,figure,figcaption,nav,article,hgroup,dialog {
display:block;
}
ul {
list-style:none;
}
img: {
border:0;
}
body {
font-famliy:"微软雅黑";
font-size:14px;
overflow-x:hidden;
}
a {
text-decoration:none;
outline:none;
}
.ellisis {
white-space:nowrap;
text-overflow:ellipsis;
overflow:hidden;
}
a:link {
text-decoration:none;
outline:none;
}
a:hover {
color:red;
}
a:active {
color:#f90;
}
/*-----------------------------------------------------修改代码-------------------------------------------------*/
p a {
padding:0 10px;
height:30px;
display:inline-block;
line-height:30px;
}
.centera {
padding:20px;
overflow:hidden;
}
.hover {
background:#737373;
}
#tablea {
border:1px solid #000000;
width:500px;
height:100px;
}
.box {
margin:10px;
display:none
}
代码作用:
$(function() {
$(".tablea").find(".box:first").show(); //为每个box的第一个元素显示
$("#oranger a").on("mouseover", function() { //给a标签添加事件
var index = $(this).index(); //获取当前a标签的个数
$(this).parent().next().find(".box").hide().eq(index).show(); //返回上一层,在下面查找css名为box隐藏,然后选中的显示
$(this).addclass("hover").siblings().removeclass("hover"); //a标签显示,同辈元素隐藏
})
})