首页  >  文章  >  web前端  >  关于Swiper的选项卡介绍

关于Swiper的选项卡介绍

零下一度
零下一度原创
2017-06-25 09:43:271566浏览

我们昨天说了关于Angular的选项卡,那今天就说一下Swiper的选项卡吧!

今天的选项卡是Zepto结合Swiper的选项卡,咱么明天再说纯纯的Swiper的吧!

既然是关于Zepto和Swiper的选项卡,那就说明了!要有关于Swiper和Zepto的插件,

分别是这两个:

zepto.min.js

swiper.min.js

还有swiper.min.css

 

就是这三个,

分别针对于布局,事件,和滑动效果哦!   好!话不多说,翠花,上代码:

 <!DOCTYPE html> <html>      <head>         <meta charset="UTF-8">
        //此乃移动端的标签         <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />         <title>选项卡哦!</title>          <link rel="stylesheet" href="js/swiper/swiper.min.css?1.1.11" />          <style type="text/css">             *                 margin: 0                 padding: 0                 font-family: "微软雅黑"                                margin: 0                                  width: 100%                 padding-                 text-                                                  width: 33%                  text-                            .tabs .part:first-                 border-              /*这些是等待被操作的样式哦!*/                     text-                 margin: 0                 font-                 text-                 padding-                                 border-                           .swiper-                 width: 100%                 border-top: 0                 margin-top: 10px!                           .swiper-                 width: 100%                  color: #373737                                text-          </style>      </head>      <body class="bgc_gray">         <div class="pg-main">             <div id="wrapper">                 <div class="wrap">                     <div class="tabs">
                //三个选项                         <span class="part active">                             <a href="#" hidefocus="true" >全免费</a>                         </span>                         <span class="part" style="border-right: 1px solid #ADDAFD">                             <a href="#" hidefocus="true">优惠券</a>                         </span>                         <span class="part">                             <a href="#" hidefocus="true">个人免费</a>                         </span>                     </div>                      <div class="swiper-container">                         <div class="swiper-wrapper">                             <div class="swiper-slide swiper-slide-visible swiper-slide-active">                                 <!--滑动区-->                                 <div class="content-slide">                                     <p>这位朋友</p>                                     <p>请在此稍作停留</p>                                     <p>你今天身上有卦 别怕</p>                                     <p>给我看看你的手</p>                                     <p>胡说八道</p>                                     <p>葫芦里卖的什么药</p>                                     <p>不过是江湖圈套 可笑</p>                                     <p>让警察把你赶跑</p>                                 </div>                             </div>                             <div class="swiper-slide">                                 <div class="content-slide">                                     <p>恕我直言</p>                                     <p>你夜晚无法安眠</p>                                     <p>你遇到一个梦魇</p>                                     <p>每天 什么藏在你床边</p>                                     <p>话音刚落</p>                                     <p>我已被冷汗浸透</p>                                     <p>他说的一点不错 拜托</p>                                     <p>请你一定救救我</p>                                 </div>                             </div>                             <div class="swiper-slide">                                 <div class="content-slide">                                     <p>我銕口直断 为你消灾解难</p>                                     <p>阴阳自在我心间 与天地周旋</p>                                     <p>一生神机妙算 只有自己看不穿</p>                                     <p>你荣华富贵在我 我生死有命在天</p>                                 </div>                             </div>                         </div>                     </div>                 </div>             </div>         </div>          <script type="text/javascript" src="js/zepto.min.js?1.1.11"></script>         <script type="text/javascript" src="js/swiper/idangerous.swiper.min.js?1.1.11"></script>         <script type="text/javascript">             $(           //获取 Swiper轮播图                                  tabsSwiper =  Swiper('.swiper-container'                     speed: 500                     onSlideChangeStart:                          $(".tabs .active").removeClass('active'                         $(".tabs span").eq(tabsSwiper.activeIndex).addClass('active'                   $(".tabs span").on('touchstart mousedown',                       $(".tabs .active").removeClass('active'                     $().addClass('active'                     tabsSwiper.swipeTo($(                   $(".tabs span").click(                });          </script>     </body>  </html>

就是这么简单,你学会了吗?

以上是关于Swiper的选项卡介绍的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn