JavaScript实现简单图片轮播效果实现简单图片轮播效果
主要介绍了JavaScript实现简单图片轮播效果,点击下标切换到该图片上,具有一定的参考价值,感兴趣的小伙
伴们可以参考一下
本文实例为大家分享了js实现简单图片轮播的具体代码,最终实现效果图
代码块代码块
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style>
* {
margin: 0;
padding: 0
}
ul {
list-style: none
}
img {
vertical-align: top
}
.box {
width: 490px;
height: 170px;
margin: 100px auto;
padding: 5px;
border: 1px solid #ccc;
}
.inner {
width: 490px;
height: 170px;
background-color: pink;
overflow: hidden;
position: relative;
}
.inner ul {
width: 1000%;
position: absolute;
top: 0;
left: 0;
}
.inner li {
float: left;
}
.square {
position: absolute;
right: 10px;
bottom: 10px;
}
.square span {
display: inline-block;
width: 16px;
height: 16px;
background-color: #fff;
text-align: center;
line-height: 16px;
cursor: pointer;
}
.square span.current {
background-color: orangered;
color: #fff;
}
评论0