本文为大家分享了js图片轮播插件的具体代码,供大家参考,具体内容如下

我封装的这个轮播插件只需要获取到图片和按钮就可以啦。
css 样式
.body{
width: 700px;
margin: 100px auto;
position: relative;
height: 300px;
overflow: hidden;
}
.body img{
width: 700px;
position: absolute;
display: none;
}
.body ul{
position: absolute;
bottom: 3px;
left: 50%;
transform: translateX(-50%);
}
.body li{
list-style: none;
float: left;
width: 15px;
height: 15px;
border-radius: 50px;
background: none;
border: 2px solid #fff;
margin-right: 10px;
cursor: pointer;
}
.active{
background-color: #fff !important;
}
.body a{
text-decoration: none;
position: absolute;
display: block;
top: 50%;
transform: translateY(-50%);
height: 50px;
width: 30px;
background-size: 100% 60%;
background-color: rgba(0,0,0,0.3);
}
.left{
left: 0;
background: url('../img/left.png') no-repeat center center;
}
.right{
right: 0;
background: url('../img/right.png') no-repeat center center;
}
另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。