Vue+swiper realizes timeline effect

Vue+swiper realizes timeline effect

This article shares the specific code of vue+swiper to achieve the timeline effect for your reference. The specific content is as follows

Effect:

First, if you have a Taobao image, use cnpm install swiper --save. If you don't have a Taobao image, use npm install swiper --save.

<template>
  <div class="hello" style="height:100%;width:100%;position:relative;">
    <div class="swiperlist">
      <div class="swipers">
        <div class="swiper-container">
          <div class="swiper-wrapper">
            <div class="swiper-slide" v-for="(activity, index) in superurl" :key="index">
              <div style="padding-left: 4px;">
                <div class="step-line"></div>
                <div class="step-content">
                  <div class="step-num"></div>
                  <div class="sub_title">{{activity.img}}</div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="buttom" v-if="superurl.length>2">
          <div class="swiper-button-prev"></div>
          <div class="swiper-button-next"></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import Swiper from "swiper";
import "../../../../../node_modules/swiper/css/swiper.min.css";
import baseMap from "./baseMap.vue";
import "../../../../../static/mapbox/css/map.css";
export default {
  name: "Map",
  components:
    baseMap
  },
  data() {
    return {
      superurl: [
        {
          url: "",
          img: "2019-01"
        },
        {
          url: "",
          img: "2019-02"
        },
        {
          url: "",
          img: "2019-03"
        },
        {
          url: "",
          img: "2019-04"
        },
        {
          url: "",
          img: "2019-05"
        },
        {
          url: "",
          img: "2019-06"
        }
      ]
    };
  },
  watch: {},
  methods: {},
  mounted() {
    var mySwiper = new Swiper(".swiper-container", {
      slidesPerView: 3, //Show three slides centeredSlides: true, //When set to true, the active slide will be centered instead of the default left.
      centerInsufficientSlides: true, //Turn on this parameter. When the total number of slides is less than slidesPerView, the slides are centered. Does not apply to loop mode and slidesPerColumn
      centeredSlidesBounds: true, //Make the first and last Slide always fit the edge.
      // loop: true, // loop // autoplay: true, // autoplay direction: "vertical", // vertical screen navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev"
      }
    });
  }
};
</script>
<style scoped>
.swiperlist {
  width: 90px;
  height: 256px;
  position: absolute;
  background: #f5f5f5;
  left: 5px;
  top: 205px;
  overflow: hidden;
  padding: 32px 0;
  border-radius: 6px;
}
.swipers {
  width: 100%;
  height: 250px;
  overflow: hidden;
}
.swiper-container {
  height: 250px !important;
}
.swiper-slide-active {
  color: #3a70ca;
}
.swiper-button-prev,
.swiper-container-rtl .swiper-button-next {
  left: 28px;
  right: auto;
  top: 15px;
  transform: rotate(90deg);
  color: #3a70ca;
}
.swiper-button-next,
.swiper-container-rtl .swiper-button-prev {
  top: 94%;
  transform: rotate(90deg);
  left: 28px;
  color: #3a70ca;
}
.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 25px;
}
.sub_title {
  margin-left: 15px;
  margin-top: -19px;
}
.step-num {
  display: inline-block;
  height: 2px;
  width: 2px;
  color: #fff;
  background-color: #3a70ca;
  line-height: 30px;
  border-radius: 50%;
  text-align: center;
  border: 2px solid #3a70ca;
  margin-top: 36px;
}
.step-num:after {
  content: "";
  width: 2px;
  height: 84px;
  border-left: 1.5px dotted #3a70ca;
  /* background-color: #3a70ca; */
  position: absolute;
  top: 0px;
  margin-left: -1px;
}
</style>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Vue implements horizontal timeline
  • Vue implements timeline function
  • Vue sample code for implementing two-column horizontal timeline
  • VUE implements timeline playback component
  • How to draw the timeline with vue+canvas
  • Vue.js implements timeline function
  • Vue realizes the logistics timeline effect
  • Vue timeline vue-light-timeline usage instructions
  • Vue implements movable horizontal timeline
  • Vue implements timeline effect

<<:  Detailed examples of Zabbix remote command execution

>>:  Summary of some small issues about MySQL auto-increment ID

Recommend

js to create a carousel effect

I think the carousel is a relatively important po...

Detailed explanation of CocosCreator message distribution mechanism

Overview This article begins to introduce content...

Detailed explanation of the problems and solutions caused by floating elements

1. Problem Multiple floating elements cannot expa...

Install MySQL (including utf8) using Docker on Windows/Mac

Table of contents 1. Docker installation on Mac 2...

Summary of MySQL logical backup and recovery testing

Table of contents 1. What kind of backup is a dat...

How to expand the disk space of Linux server

Table of contents Preface step Preface Today I fo...

What is Software 404 and 404 Error and what is the difference between them

First of all, what is 404 and soft 404? 404: Simpl...

Solution to Docker's failure to release ports

Today I encountered a very strange situation. Aft...

Use of Linux gzip command

1. Command Introduction The gzip (GNU zip) comman...

Problems and solutions when installing and using VMware

The virtual machine is in use or cannot be connec...

Causes and solutions for MySQL deadlock

The database, like the operating system, is a sha...

How to check the version of Kali Linux system

1. Check the kali linux system version Command: c...

Introduction to HTML_PowerNode Java Academy

What is HTML? HTML is a language used to describe...

Realizing the effect of carousel based on jQuery

This article shares the specific code of jQuery t...

SQL Server database error 5123 solution

Because I have a database tutorial based on SQL S...