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