抽牌效果之banner轮播
banner轮播方式真的很多,这也算一种特别的轮播方式了吧~
css3结合jq,炫的都是css3的功劳。
Html:
-
-
-
Css:
#fp-box,.fp-img-box li, .fp-img-box{
width:100%;
padding-bottom: 30%;
height: 0;
}
.fp-box{
position: relative;
overflow: hidden;
}
.fp-img-box{
margin-bottom: 0;
-webkit-perspective: 800px;
perspective: 800px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.fp-img-box li{
position: absolute;
top:0;
left: 0;
visibility: hidden;
}
.fp-img-box li img{
width: 100%;
}
.fp-num-box{
position: absolute;
bottom: 5px;
width: 100%;
text-align: center;
margin-bottom: 0;
}
.fp-num-box li{
width: 12px;
height: 12px;
background: #fff;
border: 2px solid #75aaa2;
display: inline-block;
border-radius: 50%;
margin: 0 2px;
cursor: pointer;
}
.fp-num-box li.active{
background: #75aaa2;
border: 2px solid #fff;
}
.fp-img-box li.show{
visibility: visible;
z-index: 10;
}
.fp-img-box li.show.right{
-webkit-animation: showright 1s ease;
animation: showright 1s ease;
}
.fp-img-box li.hides.right{
-webkit-animation: hideright 1s ease;
animation: hideright 1s ease;
}
.fp-img-box li.show.left{
-webkit-animation: showleft 1s ease;
animation: showleft 1s ease;
}
.fp-img-box li.hides.left{
-webkit-animation: hideleft 1s ease;
animation: hideleft 1s ease;
}
@-webkit-keyframes showright {
0%{ -webkit-transform: translateZ(-200px)}
50%{ -webkit-transform: translate(40%,0) scale(0.8) rotateY(-30deg)}
100%{ -webkit-transform: translateZ(0px)}
}
@keyframes showright {
0%{ transform: translateZ(-200px)}
50%{ transform: translate(40%,0) scale(0.8) rotateY(-30deg)}
100%{ transform: translateZ(0px)}
}
@-webkit-keyframes hideright {
0%{ -webkit-transform: translateZ(0px);visibility: visible;}
50%{ -webkit-transform: translate(-40%, 0) scale(0.8) rotateY(30deg)}
100%{ -webkit-transform: translateZ(-200px);visibility: hidden;}
}
@keyframes hideright {
0%{ transform: translateZ(0px);visibility: visible;}
50%{ transform: translate(-40% ,0) scale(0.8) rotateY(30deg)}
100%{ transform: translateZ(-200px);visibility: hidden}
}
@-webkit-keyframes showleft {
0%{ -webkit-transform: translateZ(-200px)}
50%{ -webkit-transform: translate(40%, 0) scale(0.8) rotateY(-30deg)}
100%{ -webkit-transform: translateZ(0px)}
}
@keyframes showleft {
0%{ transform: translateZ(-200px)}
50%{ transform: translate(40% ,0) scale(0.8) rotateY(-30deg)}
100%{ transform: translateZ(0px)}
}
@-webkit-keyframes hideleft {
0%{ -webkit-transform: translateZ(0px);visibility: visible;}
50%{ -webkit-transform: translate(-40%, 0) scale(0.8) rotateY(30deg)}
100%{ -webkit-transform: translateZ(-200px);visibility: hidden;}
}
@keyframes hideleft {
0%{ transform: translateZ(0px);visibility: visible;}
50%{ transform: translate(-40% ,0) scale(0.8) rotateY(30deg)}
100%{ transform: translateZ(-200px);visibility: hidden}
}
JS:
$(function () {
var img = $(".fp-img-box li");
var size = img.size();
//生成小圆点
var _LiHtml='';
for(var i=0;i< size;i++){
_LiHtml+=' 2019.10.11