Exploration caused by swiper carousel

Source: Internet
Author: User

 

When talking about swiper carousel plug-ins, friends should not feel unfamiliar. In the past, I mainly used mobile terminals, but few PCs.

  Note:Note that swiper is different on PC and mobile.

 

Three official versions are available: swiper2, swiper3, and swiper4.

   Official website of swiper2: https://2.swiper.com.cn/     Swiper3 Official Website: Https://3.swiper.com.cn/ Swiper4 Official Website: https://www.swiper.com.cn/

  

  Note:If swiper2 is used on the PC side, swiper2 is recommended; swiper3 or swiper4 is used on the mobile side; the official explanation is as follows:

  

   

So the question is, what is the difference between the three versions? The following are official documents:

 

  

 

 

 

  

  

 

During use, the PC and mobile terminals encountered a problem

 

  Mobile Terminal question: Is it ineffective after the automatic carousel attribute is set? (The CSS file paths and versions are correct)

  Solution:Because of the CSS file I introduced, The JS file is the swiper4 version, but I use the setting method of the swiper3 version.

   Swiper3 sets automatic playback: autoplay: 3000

Swiper4 sets automatic playback: autoplay: {delay: 3000}. (You can also set autoplay: True to automatically switch between three seconds by default ,)

 

Swiper4 integrates the options of the component and modifies the way the callback function obtains the swiper instance as the this keyword.

  Is the official place for L's swiper3 API and swiper4 API

  

 

Problems encountered on the PC side: You want to move the mouse to the carousel image and pause the playback. After the mouse is removed from the carousel image, the playback will resume.  Solution:Swiper itself does not encapsulate the mouse move in and out event. You need to add the event and then call the relevant APIs (myswiper. Autoplay. Stop (); and myswiper. Autoplay. Start ();)
VaR myswiper = new swiper ('. swiper-iner ', {autoplay: True,}) $ ('. swiper-slide '). mouseover (function () {myswiper. autoplay. stop (); // pause playing}) $ ('. swiper-slide '). mouseout (function () {myswiper. autoplay. start (); // start playing })

 

  

  

  

Exploration caused by swiper carousel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.