Home Web Front-end JS Tutorial How to use swiper mobile carousel plug-in

How to use swiper mobile carousel plug-in

Jun 14, 2018 pm 04:53 PM
swiper Mobile terminal Carousel

This article mainly introduces the swiper mobile carousel plug-in in detail. After touching the picture, the carousel stops, which has a certain reference value. Interested friends can refer to the example of this article

I have shared the swiper mobile carousel plug-in for your reference. The specific content is as follows

The following are the problems I encountered and several parameters commonly used with this plug-in. If your carousel does not require a lot of It’s complicated, you can solve it by reading this article. If you want to know more, here is the official address of the swiper plug-in.

The first stepIntroducing swiper.min.js

<script src="../style/js/swiper.min.js"></script>
Copy after login

The second stephtml

<p class="swiper-container">
  <p class="swiper-wrapper">
    <p class="swiper-slide">
      <img alt="" src="http://wx.okair.net/wxpic/wxb2c/indexpage/index_banner1.jpg">
    </p>
    <p class="swiper-slide">
      <img alt="" src="http://wx.okair.net/wxpic/wxb2c/indexpage/index_banner2.jpg">
    </p>
    <p class="swiper-slide">
      <img alt="" src="http://wx.okair.net/wxpic/wxb2c/indexpage/index_banner3.jpg">
    </p>
  </p>
  <p class="swiper-pagination"></p> <!--需要轮播序号的时候写-->
</p>
Copy after login

The third step StepCalling (here’s the point)

var mySwiper = new Swiper(&#39;.swiper-container&#39;, {
    pagination : &#39;.swiper-pagination&#39;,
    loop : true,
    autoplay : 3000
});
Copy after login

Now in this case, the picture can be automatically rotated, but when it is touched by hand, the rotation will stop, so you need to add another parameter

var mySwiper = new Swiper(&#39;.swiper-container&#39;, {
    pagination : &#39;.swiper-pagination&#39;,
    loop : true,
    autoplay : 3000,
    autoplayDisableOnInteraction : false  /* 注意此参数,默认为true */ 
});
Copy after login

No matter how you slide, the carousel event will be retriggered.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to implement snow animation effect in jQuery

How to implement list pull-down refresh in WeChat applet Pull loading effect?

How to use the digital scroll plug-in in WeChat mini program

The above is the detailed content of How to use swiper mobile carousel plug-in. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problems encountered when using swiper in vue3 How to solve the problems encountered when using swiper in vue3 May 11, 2023 pm 01:07 PM

1. Install swiper. Use npminstallswiper to install the swpier plug-in npminstallswiper-s//@9.2.0// or install the specified version npminstallswiper@8.4.7-s. 2. Use swiper to directly follow the reference method on the official website. The project will report an error. Solution: introduced The component uses the following path import{Swiper,SwiperSlide}from "swiper/vue/swiper-vue"; import "swiper/swiper.min.css"; sometimes required

How to use mobile gesture operations in Vue projects How to use mobile gesture operations in Vue projects Oct 08, 2023 pm 07:33 PM

How to use mobile gesture operations in Vue projects With the popularity of mobile devices, more and more applications need to provide a more friendly interactive experience on the mobile terminal. Gesture operation is one of the common interaction methods on mobile devices, which allows users to complete various operations by touching the screen, such as sliding, zooming, etc. In the Vue project, we can implement mobile gesture operations through third-party libraries. The following will introduce how to use gesture operations in the Vue project and provide specific code examples. First, we need to introduce a special

Solve the problem of multi-touch points on Vue mobile terminal Solve the problem of multi-touch points on Vue mobile terminal Jun 30, 2023 pm 01:06 PM

In mobile development, we often encounter the problem of multi-finger touch. When users use multiple fingers to swipe or zoom the screen on a mobile device, how to accurately recognize and respond to these gestures is an important development challenge. In Vue development, we can take some measures to solve the problem of multi-finger touch on the mobile terminal. 1. Use the vue-touch plug-in vue-touch is a gesture plug-in for Vue, which can easily handle multi-finger touch events on the mobile side. We can install vue-to via npm

How to implement the automatic carousel function of web pages in JavaScript? How to implement the automatic carousel function of web pages in JavaScript? Oct 16, 2023 am 09:25 AM

How does JavaScript implement the automatic carousel function of web pages? With the popularity of the Internet, the design and display methods of web pages are becoming more and more diverse. Among them, the automatic web page carousel function has become one of the common elements in many websites and applications. This article will introduce how to use JavaScript to implement the automatic carousel function of web pages and provide specific code examples. 1. HTML structure Before implementing the automatic carousel function, you first need to determine the HTML structure of the web page. Generally speaking, automatic carousel functions often use pictures or other content

How to use Swiper with Vue3? How to use Swiper with Vue3? May 09, 2023 pm 04:01 PM

This article introduces the use of swiper in vue3 to achieve the effect of carousel diagrams; if modules such as component styles are introduced improperly, it is likely to cause the page to have no effect; or the desired arrow or switching effect will be abnormal. The specific usage is as follows: Use the command npminstallswiper to install the swiper plug-in; use the style file in main.js, as shown below: importAppfrom'./App.vue'importrouterfrom'./router'importVueAwesomeSwiperfrom&amp

How to solve the double-click amplification problem on mobile terminals in Vue development How to solve the double-click amplification problem on mobile terminals in Vue development Jun 29, 2023 am 11:06 AM

With the popularity of mobile devices, using Vue for mobile development has become a common choice. However, we often face a problem during mobile development, which is double-clicking to zoom in. This article will focus on this problem and discuss how to solve the specific method of double-click amplification on the mobile terminal in Vue development. The double-click enlargement problem on mobile devices occurs mainly because the mobile device automatically enlarges the zoom ratio of the web page when double-clicking on the touch screen. For general web development, this kind of double-click to enlarge is usually beneficial because it can

A complete guide to implementing mobile responsive layout in Vue (Vant) A complete guide to implementing mobile responsive layout in Vue (Vant) Jun 09, 2023 pm 04:09 PM

A Complete Guide to Implementing Mobile Responsive Layout in Vue (Vant) Mobile responsive layout is a very important part of modern web development. With the popularity of mobile devices, how to quickly respond to the size and resolution of the user's mobile phone screen has become a One of the challenges front-end engineers have to face. The Vue framework comes with responsive layout features, and there are also many third-party libraries to help us implement responsive layout. Among them, Vant component library is a Vue mobile UI library because it is very powerful, easy to use and customized, and is fully compatible with mobile devices.

CSS attribute techniques to achieve image carousel effect CSS attribute techniques to achieve image carousel effect Nov 18, 2023 am 08:12 AM

CSS attribute techniques to achieve image carousel effects require specific code examples. In modern web design, image carousel effects have become one of the most common elements. With image carousel effects, web pages can be more dynamic and attractive. This article will introduce several CSS property techniques to achieve image carousel effects, and give specific code examples. Use the animation attribute to implement image carousel. The animation attribute is a property in CSS3 that can be used to create animation effects. By setting the animation attribute and @

See all articles