swiper
Posted 森海轮回
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swiper相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Swiper demo</title> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <link rel="stylesheet" href="swiper.min.css"> <script src="swiper.min.js"></script> <style> html, body { position: relative; height: 100%; } body { background: #eee; font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color:#000; margin: 0; padding: 0; } .swiper-container2 { width: 100%; height: 100%; } .swiper-container { width: 100%; height: 100%; } .swiper-slide { text-align: center; font-size: 18px; background: #fff; /* Center slide text vertically */ 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; } .miaomiao{ background-color: #fff; position: absolute; top:50px; height:200px; width:100%; } .miaomiao2{ position: absolute; top:300px; height:200px; width:100%; background-color: #fff; } .swiper-button-next{ outline: none; } .swiper-button-prev{ outline: none } </style> </head> <body> <div class="miaomiao"> <div class="swiper-container2"> <div class="swiper-wrapper"> <div class="swiper-slide"> <div style="width:80%;height:100%;background: #ddd;position: absolute;"> <div>name1</div> </div> </div> <div class="swiper-slide"> <div style="width:80%;height:100%;background: #ddd;position: absolute;"> <div>name2</div> </div> </div> </div> <div class="swiper-button-next"></div> <div class="swiper-button-prev"></div> </div> <div class="miaomiao2" style=""> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"> <div style="width:80%;height:100%;background: #ddd;position: absolute;"> <div>name3</div> </div> </div> <div class="swiper-slide"> <div style="width:80%;height:100%;background: #ddd;position: absolute;"> <div>name4</div> </div> </div> </div> <div class="swiper-button-next swiper-button-next1"></div> <div class="swiper-button-prev swiper-button-prev1"></div> </div> </div> </div> <script> new Swiper(‘.swiper-container2‘, { navigation: { nextEl: ‘.swiper-button-next‘, prevEl: ‘.swiper-button-prev‘, }, }); new Swiper(‘.swiper-container‘, { navigation: { nextEl: ‘.swiper-button-next1‘, prevEl: ‘.swiper-button-prev1‘, }, }); </script> </body> </html>
以上是关于swiper的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 slick/swiper/或任何其他插件或原始代码制作以下滑块?