原生js实现轮播图幻灯片切换效果代码
代码语言:html
所属分类:幻灯片
代码描述:原生js实现轮播图幻灯片切换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* Carousel specific styles */ .mvp-carousel { overflow: hidden; padding: 3rem; position: relative; margin: 5rem auto 0 auto; width: 20rem; box-shadow: 0 0 6rem -1rem #00000048; } .mvp-carousel-wrapper { display: flex; transition: transform .5s ease; position: relative; } .mvp-card { display: flex; justify-content: center; align-items: center; flex: 0 0 12rem; min-height: 17rem; position: relative; left: -100%; background: rgb(85, 122, 192); box-sizing: border-box; padding: 1rem; font-size: 1.4rem; font-family: Arial, Helvetica, sans-serif; text-align: center; transition: opacity .6s, background 1.2s, transform .8s, left .5s; transform: scale(.75) rotate(5deg); box-shadow: 0 0 2rem 0 #00000048; } .mvp-card--bottom { left: 1.8rem; transform: scale(0.9) rotate(0); z-index: 1; } .mvp-card--middle { left: -8.5rem; transform: scale(0.98) rotate(0); z-index: 2; } .mvp-card--active { transform: scale(1.1) rotate(0); opacity: 1; background: rgb(22, 32, 51); color: white; z-index: 3; left: -18.5rem; } .isHidden{ opacity: 0; pointer-events: none; z-index: 0; } .z-index-high{ z-index: 6; } .mvp-carousel__prevBtn, .mvp-carousel__nextBtn { position: absolute; background: none; top: 50%; padding: 10px; border: solid rgb(22, 32, 51); border-width: 0 3px 3px 0; display: inline-block; cursor: pointer; } .mvp-carousel__nextBtn { left: 1.5rem; transform: rotate(135deg); } .mvp-carousel__prevBtn { right: 1.5rem; transform: rotate(-45deg); } </style> </head> <body translate="no"> <div class="mvp-carousel" data-visible="3"> <div class="mvp-carousel-wrapper"> <div class="mvp-card isHidden">12</div> <div class="mvp-card isHidden">11</div> <div class="mvp-card isHidden">10</div> <div class="mvp-card isHidden">9</div> <div class="mvp-card isHidden">8</div> <div class="mvp-card isHidden">7</div> <div class="mvp-card isHidden">6</div> <div class="mvp-card isHidden">5</div> <div class="mvp-card isHidden">4</div> <div class="mvp-card mvp-card--bottom">3</div> <div class="mvp-card mvp-card--middle">2</div> <div class="mvp-card mvp-card--active">.........完整代码请登录后点击上方下载按钮下载查看
网友评论0