本文實例講述了jQuery自適應輪播圖插件Swiper用法。分享給大家參考,具體如下:
運行效果截圖如下:
範例程式碼如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no"> <title>新建H5自适应模板</title> <link rel="stylesheet" href="swiper-3.3.1.min.css"> <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-container { width: 100%; height: 100%; } .swiper-slide { text-align: center; font-size: 18px; background: #fff; 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; } </style> </head> <body> <div> <div> <div><img src="images/banner01.jpg" alt="jQuery自適應輪播圖外掛程式Swiper用法範例" ></div> <div><img src="images/banner02.jpg" alt="jQuery自適應輪播圖外掛程式Swiper用法範例" ></div> <div><img src="images/banner03.jpg" alt="jQuery自適應輪播圖外掛程式Swiper用法範例" ></div> </div> <div></div> </div> <script src="jquery-1.10.1.min.js"></script> <script src="swiper-3.3.1.jquery.min.js"></script> <script> var swiper = new Swiper('.swiper-container', { pagination: '.swiper-pagination', paginationClickable: true }); </script> </body> </html>
希望本文所述對大家jQuery程式設計有所幫助。
更多jQuery自適應輪播圖插件Swiper用法範例相關文章請關注PHP中文網!