jquery+swiper实现时间轴tab滑动切换显示效果

根据时间轴进行tab页面内容切换?下面本篇文章给大家介绍一下jquery时间轴tab切换效果实现结合swiper实现滑动显示效果的方法,希望对大家有所帮助!

jquery+swiper实现时间轴tab滑动切换显示效果

前端(vue)入门到精通课程:进入学习

需求:根据时间轴进行tab页面内容切换(时间轴需要滑动查看并选择)

实现思路:

结合swiper插件实现滑动显示效果

根据transform: translateX进行左侧切换效果的实现(具体实现css如下),实现非滚动的点击切换效果,结合swiper进行修改。【相关教程推荐:jQuery教程】

实现效果:

jquery+swiper实现时间轴tab滑动切换显示效果

实现代码:需要配合swiper组件使用;左侧导航是根据html结构和css3代码,来生成的时间轴效果效果来源于http://www.htmleaf.com/css3/ui-design/201911275850.html

Swiper基础演示地址:https://www.swiper.com.cn/demo/index.html

HTML:

  <div class="swiper-container box">
    <div class="swiper-wrapper main-timeline">
      <div class="swiper-slide timeline fd-active-line">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2019</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
      <div class="swiper-slide timeline">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2018</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
      <div class="swiper-slide timeline">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2017</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
      <div class="swiper-slide timeline">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2016</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
      <div class="swiper-slide timeline">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2015</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
      <div class="swiper-slide timeline">
        <a href="javascript:void(0);" class="timeline-content">
          <div class="timeline-year">
            <span>2014</span>
          </div>
        </a>
        <div class="xians"></div>
      </div>
    </div>
  </div>
  <ul class="event_list">
    <div>
      <h3 id="2012">2019</h3>
      <img src="./img/lh.jpg" alt="">
    </div>
    <div style="display: none;">
      <h3 id="2012">2018</h3>
      <img src="./img/lhls.jpg" alt="">
    </div>
    <div style="display: none;">
      <h3 id="2011">2017</h3>
      <img src="./img/lkss.jpg" alt="">
    </div>
    <div style="display: none;">
      <h3 id="2011">2016</h3>
      <img src="./img/luhu.jpg" alt="">
    </div>
    <div style="display: none;">
      <h3 id="2011">2015</h3>
      <img src="./img/luhuwhite.jpg" alt="">
    </div>
    <div style="display: none;">
      <h3 id="2011">2014</h3>
      <img src="./img/lhls.jpg" alt="">
    </div>
  </ul>
  </div>

郑重声明:本文版权包含图片归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们(delete@yzlfxy.com)修改或删除,多谢。

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

留言与评论(共有 0 条评论)
昵称:
匿名发表
   
验证码: