html 页面
<html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="carousel.css" rel="external nofollow" > <title>轮播图效果</title></head><body> <section id="main"> <div id="picture"></div> <!-- 添加图中按钮 图片轮播在js中大致成型后再写最好--> <div id="dot"> <span></span> <span></span> <span></span> <span></span> <span></span> </div> <!-- 添加切换按钮 --> <div id="an"> <div class="left"><</div> <div class="right">></div> </div> </section> <script src="jquery.js"></script> <script src="carousel.js"></script></body>css页面 carousel.css
#main{ width: 655px; height: 361px; position: relative;}#picture{ width:100%; height: 100%;}#picture img{ width:100%; height: 100%; display: none;}#picture img:nth-child(1){ display: inline-block;}#dot span{ display: inline-block; width:25px; height: 25px; border-radius: 50%; background-color: gray; margin-left: 10px; opacity: 0.6}#dot{ position: absolute; right: 40px; bottom: 30px;} #dot :nth-of-type(1){ transform: scale(1.2); background-color: blue; } .left ,.right{ width: 40px; height: 40px; border-radius: 50%; font-size: 30px; color: white; position: absolute; bottom: calc((100% - 40px)/2); text-align: center; } .left{ left: 15px; } .right{ right: 15px; } .left:hover ,.right:hover{ background-color: white; color:red; }js页面 carousel.js
以上这篇使用html+js+css 实现页面轮播图效果(实例讲解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。