swiper移动端导航条的实现
时间:6年前 阅读:4473
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width,initial-scale=1.0"/> <!--写移动端要用meta开头--> <link rel="stylesheet" type="text/css" href="../uu/swiper-4.4.1.min.css"/> <style type="text/css"> *{ padding: 0; margin: 0; } .swiper-container { width: 100%; height: ; border: 1px solid darkcyan; box-shadow: 0 0 10px 0px rgba(0,0,0,0.5); } .swiper-container .swiper-wrapper .swiper-slide{ line-height: 3em; width: auto; padding: 0 10px; } </style> </head> <body> <div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide">国内</div> <div class="swiper-slide">国际</div> <div class="swiper-slide">体育</div> <div class="swiper-slide">娱乐</div> <div class="swiper-slide">军事</div> <div class="swiper-slide">科技</div> </div> <!-- 如果需要导航按钮 --> <div class="swiper-button-prev"></div> <div class="swiper-button-next"></div> </div> <script src="../uu/swiper-4.4.1.min.js" type="text/javascript"></script> <script> var mySwiper = new Swiper ('.swiper-container', { slidesPerView : 'auto', //显示数量,auto 自动 direction: 'horizontal', // 垂直切换选项 // loop: true, // 无缝循环模式选项 // 如果需要前进后退按钮 navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }) </script> </body> </html>
本站声明:网站内容来源于网络,如有侵权,请联系我们https://www.qiquanji.com,我们将及时处理。
微信扫码关注
更新实时通知
网友评论