先上效果图
因为录制工具的问题,效果图看起来有些卡顿,实际不会哦
实现的效果:
1.左右切换
2.自动轮播
3.鼠标移入停止自动轮播,移出继续自动轮播
4.小圆点跟随变化
5.设置了节流,降低了点击次数过快带来的瑕疵
左右按钮我使用了字体图标,自行更改哦
上代码:
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>无缝轮播</title>
<style>
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?8b1uab');
src: url('fonts/icomoon.eot?8b1uab#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?8b1uab') format('truetype'),
url('fonts/icomoon.woff?8b1uab') format('woff'),
url('fonts/icomoon.svg?8b1uab#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
* {
margin: 0;
padding: 0;
}
body {
background-color: rgb(243, 245, 247);
}
li {
list-style: none;
}
#wrap {
position: relative;
width: 900px;
margin: 200px auto;
overflow: hidden;
border-radius: 20px;
box-shadow: 0px 0px 10px 5px rgb