TA的每日心情 | 奋斗 2016-6-30 18:09 |
---|
签到天数: 1 天 [LV.1]初来乍到
新手上路
- 积分
- 24
|
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Swiper demo</title>
- <!-- Link Swiper's CSS -->
- <link rel="stylesheet" href="../css/swiper-3.3.1.min.css"></style>
- <!-- Demo styles -->
- <style>
- body {
- background: #eee;
- font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
- font-size: 14px;
- color:#000;
- margin: 0;
- padding: 0;
- }
- .swiper-container {
- width: 500px;
- height: 300px;
- margin: 20px auto;
- }
- .swiper-slide, .swiper-slide0 {
- 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;
- }
- </style>
- </head>
- <body>
- <h1>基础使用</h1>
- <!-- Swiper -->
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide">Slide 1</div>
- <div class="swiper-slide">Slide 2</div>
- <div class="swiper-slide">Slide 3</div>
- <div class="swiper-slide">Slide 4</div>
- <div class="swiper-slide">Slide 5</div>
- <div class="swiper-slide">Slide 6</div>
- <div class="swiper-slide">Slide 7</div>
- <div class="swiper-slide">Slide 8</div>
- <div class="swiper-slide">Slide 9</div>
- <div class="swiper-slide">Slide 10</div>
- </div>
- <!-- 如果需要分页器 -->
- <div class="swiper-pagination"></div>
- <!-- 如果需要导航按钮 -->
- <div class="swiper-button-prev"></div>
- <div class="swiper-button-next"></div>
-
- <!-- 如果需要滚动条 -->
- <div class="swiper-scrollbar"></div>
- </div>
- <!-- Swiper JS -->
- <script src="../js/jquery.min.js"></script>
- <script src="../js/swiper-3.3.1.jquery.min.js"></script>
- <!-- Initialize Swiper -->
- <script>
- var swiper = new Swiper('.swiper-container', {
- direction: 'vertical',
- loop: true,
- // 如果需要分页器
- pagination: '.swiper-pagination',
- // 如果需要前进后退按钮
- nextButton: '.swiper-button-next',
- prevButton: '.swiper-button-prev',
- // 如果需要滚动条
- scrollbar: '.swiper-scrollbar',
- });//初始化swiper插件
- </script>
- <h2>让分页器的事件生效</h2>
- <div class="swiper-container">
- <div class="swiper-wrapper">
- <div class="swiper-slide">Slide 1</div>
- <div class="swiper-slide">Slide 2</div>
- <div class="swiper-slide">Slide 3</div>
- <div class="swiper-slide">Slide 4</div>
- <div class="swiper-slide">Slide 5</div>
- <div class="swiper-slide">Slide 6</div>
- <div class="swiper-slide">Slide 7</div>
- <div class="swiper-slide">Slide 8</div>
- <div class="swiper-slide">Slide 9</div>
- <div class="swiper-slide">Slide 10</div>
- </div>
- <!-- Add Pagination -->
- <div class="swiper-pagination"></div>
- </div>
- <script>
- var swiper2 = new Swiper('.swiper-container', {
- pagination: '.swiper-pagination',
- paginationClickable: true
- });
- </script>
- <!-- Swiper -->
- <div class="swiper-container">
- <div class="swiper-wrapper_0">
- <div class="swiper-slide">Slide 1</div>
- <div class="swiper-slide">Slide 2</div>
- <div class="swiper-slide">Slide 3</div>
- <div class="swiper-slide">Slide 4</div>
- <div class="swiper-slide">Slide 5</div>
- <div class="swiper-slide">Slide 6</div>
- <div class="swiper-slide">Slide 7</div>
- <div class="swiper-slide">Slide 8</div>
- <div class="swiper-slide">Slide 9</div>
- <div class="swiper-slide">Slide 10</div>
- </div>
- <!-- Add Pagination -->
- <div class="swiper-pagination"></div>
- </div>
- <script>
- var swiper = new Swiper('.swiper-container', {
- pagination: '.swiper-pagination',
- paginationClickable: true,
- spaceBetween: 30,
- wrapperClass : 'swiper-wrapper_0',
- });
- </script>
- </body>
- </html>
复制代码 已经使用命名空间,然而无效
|
|