>  기사  >  웹 프론트엔드  >  Swiper의 탭 소개

Swiper의 탭 소개

零下一度
零下一度원래의
2017-06-25 09:43:271566검색

어제 Angular 탭에 대해 이야기했으니 오늘은 Swiper 탭에 대해 이야기해보겠습니다!

오늘의 탭은 Swiper 탭과 결합된 Zepto, 내일은 순수 Swiper에 대해 이야기해보겠습니다!

이제 Zepto와 Swiper에 대한 탭입니다. 는 Swiper 및 Zepto용 플러그인입니다.

는 각각 다음 두 가지입니다.

zepto.min.js

swiper.min.js

및 swiper .min.css

이 세 가지는

입니다. 레이아웃, 이벤트, 슬라이딩 효과에 대해 각각! 좋습니다! Cuihua님, 코드는 다음과 같습니다.

 <!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으로 문의하세요.