原生js实现无缝轮播图效果

前端之家收集整理的这篇文章主要介绍了原生js实现无缝轮播图效果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

话不多说,请看代码

<Meta charset="UTF-8"> 无缝轮播图-原生js封装 css-3*/ white-space: -moz-pre-wrap; /*Mozilla,since1999*/ white-space: -pre-wrap; /*Opera4-6*/ white-space: -o-pre-wrap; /*Opera7*/ word-wrap: break-word; /*InternetExplorer5.5+*/ } .example{ padding-top:40px; margin-bottom:90px; } .example .call{ padding:18px 5px; background:#f0f5f8; } .example h2{ padding-top:20px; margin-bottom:7px; } .example table { width:100%; table-layout:fixed; border-collapse: collapse; border-spacing: 0; border: 1px solid #cee1ee; border-left: 0; } .example thead { border-bottom: 1px solid #cee1ee; background-color: #e3eef8; } .example tr { line-height: 24px; font-size: 13px; } .example tr:nth-child(2n) { background-color: #f0f5f8; } .example tr th,.example tr td { border-left: 1px solid #cee1ee; word-break: break-all; word-wrap: break-word; padding:0 10px; font-weight: normal; } .example tr th { color: #555; padding-top: 2px; padding-bottom: 2px; text-align: left; } /*公共*/ .bannerha-container{ width: 800px; height: 300px; margin: 20px auto; overflow: hidden; position: relative; } .bannerha-wrapper{ width: 100%; height: 100%; position: absolute; display: -webkit-Box; display: Box; } .bannerha-slide{ background: #ccc; list-style: none; width: 100%; height: 100%; text-align: center; font-size: 18px; display: -webkit-Box; display: -ms-flexBox; display: -webkit-flex; display: flex; -webkit-Box-pack: center; -ms-flex-pack: center; -webkit-justify-content: center; justify-content: center; -webkit-Box-align: center; -ms-flex-align: center; -webkit-align-items: center; align-items: center; } .bannerha-pagination{ position: absolute; text-align: center; z-index: 10;

bottom: 10px;
left: 0;
width: 100%;
}
.bannerha-pagination-bullet{
width: 8px;
height: 8px;
display: inline-block;
border-radius: 100%;
background: #fff;
opacity: .5;
margin: 0 4px;
}
.bannerha-pagination-bullet-active{
opacity: 1;
background: #ff0;
}
.bannerha-button{
width: 100px;
height: 100%;
position: absolute;
top: 0;
background-color: #333;
z-index: 1;
cursor: pointer;
filter: alpha(opacity:20);
opacity: 0.2;
-webkit-transition: all .2s ease-in;
-moz-transition: all .2s ease-in;
-ms-transition: all .2s ease-in;
-o-transition: all .2s ease-in;
transition: all .2s ease-in;
}
.bannerha-button.active{
filter: alpha(opacity:60);
opacity: 0.6;
}
.bannerha-button-prev{
left:0;
}
.bannerha-button-next{
right:0;
}

  • 调整自动轮播速度和缓冲速度

    new bannerha("#banner2",times: 1500 });

  • 关闭左右切换按钮

    new bannerha("#banner4",{ pnBtn: false });

  • 猜你在找的JavaScript相关文章