我无法确定当用户单击其相应编号或prev/next箭头时如何添加和删除类中的类。如何使用项目符号和箭头添加/删除类
请注意第二项以及第二项导航上的'active'类。当用户点击“1”或“上一个”箭头时,我希望该课程被移除并添加到第一个项目和导航栏中。
.wrap {
display: block;
width: 200px;
margin: 50px auto;
text-align: center;
}
.nav {
margin-bottom: 10px;
}
.nav a {
padding: 5px;
}
.nav a:hover {
font-weight: 900;
cursor: pointer;
}
.nav a.active {
border-bottom: 1px solid black;
font-weight: 900;
}
.prev, .next {
display: inline-block;
padding: 5px;
}
.prev:hover, .next:hover {
font-weight: 900;
cursor: pointer;
}
.items div {
display: none;
padding: 25px;
}
.items .one {
background: red;
}
.items .two {
background: green;
}
.items .three {
background: blue;
}
.items .active {
display: inline-block;
}
<div class="wrap">
<div class="nav">
<a class="one">1</a>
<a class="two active">2</a>
<a class="three">3 </a>
</div>
<div class="items">
<span class="prev"><</span>
<div class="one">ONE</div>
<div class="two active">TWO</div>
<div class="three">THREE</div>
<span class="next">></span>
</div>
</div>
http://codepen.io/bbbenji/pen/WovJEM
点击不工作的指出 – Weedoze
@Weedoze感谢这样做的[R方式。请检查更新 – Rajesh
现在它很漂亮嘿嘿 – Weedoze