用swiper制作滚动条
<--->css部分
<style type="text/css" rel="sheetstyle">
html, body {
position: relative;
height: 100%;
}
body {
background: #fff;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color:#000;
margin: 0;
padding: 0;
}
.swiper-container {
width: 500px;
height: 500px;
}
.swiper-slide {
font-size: 18px;
height: auto;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.swiper-slide ul li {
width:200px;
height:50px;
}
.swiper-slide ul li a {
display:block;
}
</style>
</head>
<--------------html部分
<body>
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<ul>
<li><a href="#">首页1</a></li>
<li><a href="#">首页2</a></li>
<li><a href="#">首页3</a></li>
<li><a href="#">首页4</a></li>
<li><a href="#">首页5</a></li>
<li><a href="#">首页6</a></li>
<li><a href="#">首页1</a></li>
<li><a href="#">首页2</a></li>
<li><a href="#">首页3</a></li>
<li><a href="#">首页4</a></li>
<li><a href="#">首页5</a></li>
<li><a href="#">首页6</a></li>
<li><a href="#">首页1</a></li>
<li><a href="#">首页2</a></li>
<li><a href="#">首页3</a></li>
<li><a href="#">首页4</a></li>
<li><a href="#">首页5</a></li>
<li><a href="#">首页6</a></li>
<li><a href="#">首页1</a></li>
<li><a href="#">首页2</a></li>
<li><a href="#">首页3</a></li>
<li><a href="#">首页4</a></li>
<li><a href="#">首页5</a></li>
<li><a href="#">首页6</a></li>
</ul>
</div>
</div>
<!-- Add Scroll Bar -->
<div class="swiper-scrollbar"></div>
</div>
<--------------script部分
<script>
var swiper = new Swiper('.swiper-container', {
direction: 'vertical',
slidesPerView: 'auto',
freeMode: true,
scrollbar: {
el: '.swiper-scrollbar',
},
mousewheel: true,
});
</script>
效果图: