![]() |
VOOZH | about |
In this article, we will learn how to design mobile touch sliders for mobile apps, mobile websites, or web apps using the JavaScript Swiper plugin.
Approach:
CDN links:
<link rel="stylesheet" href="https://unpkg.com/swiper@7.4.1/swiper-bundle.min.css" /> <script src="http://code.jquery.com/jquery-1.9.1.min.js"> </script> <script src="https://unpkg.com/swiper@7.4.1/swiper-bundle.min.js"></script>
Example 1: The following example demonstrates a basic slider using the Swiper plugin. Other attributes of the plugin can also be set as per the need. The page is designed with HTML div elements with the plugin's classes namely "swiper-container", "swiper-wrapper", "swiper-slide", "swiper-pagination" and other classes. Use the HTML img element for inserting various images for the slider. The slider is initialized in the script part of the below code with options setting.
Output:
Example 2: In the following example, we just change or adjust the options values for the attributes in the script part of the code for the above HTML code. The developer can change or add according to the application's need. Two slides are visible at one time with a progress bar in the top and bottom of the slider.
Output: