轮播图是非常常见的页面交互效果,也是非常实用的效果,一直基础js学习都少不了需要制作轮播图,话不多说,上代码
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.box {
position: relative;
height: 600px;
}
.item {
position: absolute;
left: 100px;
top: 0;
width: 1200px;
height: 600px;
display: none;
}
img {
width: 100%;
height: 100%;
}
.nav {
position: relative;
}
ul {
position: absolute;
top: -50px;
left: 600px;
list-style: none;
z