<div class="slider">
<div id="one" class="box"></div>
<div id="two" class="box"></div>
<div id="three" class="box"></div>
</div>
<nav>
<a href="#one">One</a>
<a href="#two">Two</a>
<a href="#three">Three</a>
</nav>
.box {
width: 500px;
height: 500px;
}
#one {
background: red;
}
#two {
background: green;
}
#three {
background: #000;
}
.slider {
width: 500px;
height: 500px;
overflow: hidden;
margin: 30px auto;
position: relative;
}
overflow: hidden 的元素就是没有滚动条的而已
你点那个锚链接,当然就滚动到那个锚点元素去了呗