This time I will bring you the implementation of the touch and slide function based on the content in Swiper 4.x on the mobile terminal. What are the precautions for Swiper 4. The following is a practical case, let’s take a look.
Swiper is a sliding special effects plug-in created purely with javascript, targeting mobile phones, tablets and other mobile terminals.
Swiper can achieve common effects such as touch screen focus image, touch screen Tab switching, touch screen multi-image switching, etc.
Swiper is open source, free, stable, simple to use, and powerful. It is an important choice for building mobile terminal websites!
1. First load the plug-in. The files required are swiper.min.js and swiper.min.css files. You can download Swiper files or use a CDN.
2.HTML content.
导航等组件可以放在container之外
3. You may want to define a size for Swiper, but of course not.
.swiper-container { width: 600px; height: 300px; }
4. Initialize Swiper: It is best to place it next to the tag
If it cannot be written behind the HTML content, it needs to be initialized after the page is loaded (not recommend).
Or like this (Jquery and Zepto)
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading: