create account

Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider by techlhab

View this thread on: hive.blogpeakd.comecency.com
· @techlhab ·
$24.27
Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider

![Tan Papercraft Art  DIY YouTube Thumbnail (13).png](https://files.peakd.com/file/peakd-hive/techlhab/23uRL1dCrueanGgRTsrKXPFpqVP8m9YKySm11oQF3qC7FTNREhZbttSSaRi5vMfTDCjvJ.png)


Swiper is a free javascript plugin or library and the most modern touch slider created by Vladimir Kharlampidi. It can be used in creating sliders with nice interactions and behavior on websites, mobile web applications, and mobile native or hybrid applications.

Swiper comes with its own responsiveness and can be integrated, installed, and used on any web front-end frameworks such as React, Vue, Angular and regular websites or web applications developed with pure HTML, CSS, and Javascript.

https://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png 
<CENTER>**GETTING STARTED WITH SWIPER**</CENTER>

Installation of swiper on web application front-end framework can be down using npm package installers as demonstrated below:

```
 $ npm install swiper
```
After successful installation, then import it using the code below:

```
  import Swiper from 'swiper';
  import 'swiper/css';

  // initialize Swiper with:
  const swiper = new Swiper(...);
```

You can then go further by adding modules like navigation, pagination, autoplay, etc. An instance is given below:

```
  // core version + navigation, pagination modules:
  import Swiper, { Navigation, Pagination } from 'swiper';

  // import Swiper and modules styles
  import 'swiper/css';
  import 'swiper/css/navigation';
  import 'swiper/css/pagination';

  // initialize Swiper with:
  const swiper = new Swiper('.swiper', {

    // configure Swiper to use modules
    modules: [Navigation, Pagination],
    ...
  });
```
And also, instead of importing the module one after the other, you can import all the modules in bundles and also all the styles in bundles using:

```
  // import Swiper bundle with all modules installed
  import Swiper from 'swiper/bundle';

  // import styles bundle
  import 'swiper/css/bundle';

  // init Swiper:
  const swiper = new Swiper(...);
```


In case you are not using front-end frameworks or package installers like npm. Swiper can be installed using the CDN or by downloading its zip file, extracting it then linking up the necessary files inside the head tag in your HTML file.

The code for installation using CDN is:
```
// This goes to the head tag in the HTML file
<link
  rel="stylesheet"
  href="https://unpkg.com/swiper@8/swiper-bundle.min.css"
/>

//While this is the Js file and should be 
//referenced appropriately inside the HTML file
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
```
The zip file can be downloaded navigating through this [link](https://unpkg.com/swiper@8/).



https://images.hive.blog/0x0/https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png 
<CENTER>**USAGE**</CENTER>

After using any of the above mentioned and explained means of installing, importing, and referencing swiper. Then swiper can now be used anywhere on the webpage by using the following format or layout:

```
//Slider main container
<div class="swiper">
  
  //Additional required wrapper
  <div class="swiper-wrapper">
    
    //Slides
    <div class="swiper-slide">Slide 1</div>
    <div class="swiper-slide">Slide 2</div>
    <div class="swiper-slide">Slide 3</div>
    ...
  </div>

  //If we need pagination
  <div class="swiper-pagination"></div>

  //If we need navigation buttons 
  <div class="swiper-button-prev"></div>
  <div class="swiper-button-next"></div>

  //If we need scrollbar
  <div class="swiper-scrollbar"></div>
</div>
```

Then initial the swiper in a Javascript file using:

```
const swiper = new Swiper('.swiper', {
  // Optional parameters
  direction: 'horizontal',
  loop: true,

  // If we need pagination
  pagination: {
    el: '.swiper-pagination',
  },

  // Navigation arrows
  navigation: {
    nextEl: '.swiper-button-next',
    prevEl: '.swiper-button-prev',
  },

  // And if we need scrollbar
  scrollbar: {
    el: '.swiper-scrollbar',
  },
});

```

Then specify the height and with you want for your swiper using your CSS, an instance is given below:

```
.swiper {
    width: 600px;
    height: 300px;
  }
```

So in other to make installing, using, and understanding of swiper easier, I also created a project to address that.


![5.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tkdpqSsBFf3nVqs4HHNL1H73cG9UXPigGvrMg18T3NQtS5HnPJDpwcQkDja6Dciz1V8.PNG)

Here is the HTML file code.

![6.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tkdTm4e5UJN6qhrFPbcEiPczNfj8RaJGPPCfQANBcx2y5DYFBbeJrBgnAehGK4stUsX.PNG)

This is code for the Javascript (Js) 
![7.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tkdTkjGQLSXitCiDBz8TzPdccBAfsC4Jda9mPGKbgwxx3rbVKT9QPf1Jh1mvHGvD3J8.PNG)


So codes above gave an output of this:
![1.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDUkKMSAGN69ouKjT44nt4LJxMaWTJZf7hnN7TDuphJQfHzbNkJmaWTCsyh8stB.PNG)

![2.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDUoEhvxfwWkRChNe4s5uCAUAsMp6A8g7oa7PYUJcUJssT9nwWB6F9FH8hroz77.PNG)

![3.PNG](https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDULD4PxHP29Do1TVAbknWfybohTEqkzpsr45wiSWxJBerAkNSBMbxL5mnng3JD.PNG)

You can get the source code of this demo project on swiper via my GitHub [link](https://github.com/Habeebllah/swiperjs) as I have uploaded the codes there. 

Also, you can visit the official swiperJS documentation website via this [link](https://swiperjs.com/).

Thanks for reading, don't forget to like, comment and share.
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 28 others
properties (23)
authortechlhab
permlinkdetailed-explanation-on-how-to-install-and-use-swiperjs-on-any-frontend-frameworks-or-web-applicationsor-the-most-modern-touch-s
categoryhive-139531
json_metadata{"app":"peakd/2022.01.2","format":"markdown","tags":["hive","programming","development","javascripts","swiper","software","palnet","neoxian","ocd","ocdb"],"users":[],"image":["https://files.peakd.com/file/peakd-hive/techlhab/23uRL1dCrueanGgRTsrKXPFpqVP8m9YKySm11oQF3qC7FTNREhZbttSSaRi5vMfTDCjvJ.png","https://images.hive.blog/DQmfDaSmTz3y8oavngRrr5mmVhrTXheYoEU4qhGUS7pq3xh/HiveDivider.png","https://files.peakd.com/file/peakd-hive/techlhab/23tkdpqSsBFf3nVqs4HHNL1H73cG9UXPigGvrMg18T3NQtS5HnPJDpwcQkDja6Dciz1V8.PNG","https://files.peakd.com/file/peakd-hive/techlhab/23tkdTm4e5UJN6qhrFPbcEiPczNfj8RaJGPPCfQANBcx2y5DYFBbeJrBgnAehGK4stUsX.PNG","https://files.peakd.com/file/peakd-hive/techlhab/23tkdTkjGQLSXitCiDBz8TzPdccBAfsC4Jda9mPGKbgwxx3rbVKT9QPf1Jh1mvHGvD3J8.PNG","https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDUkKMSAGN69ouKjT44nt4LJxMaWTJZf7hnN7TDuphJQfHzbNkJmaWTCsyh8stB.PNG","https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDUoEhvxfwWkRChNe4s5uCAUAsMp6A8g7oa7PYUJcUJssT9nwWB6F9FH8hroz77.PNG","https://files.peakd.com/file/peakd-hive/techlhab/23tT2CPDULD4PxHP29Do1TVAbknWfybohTEqkzpsr45wiSWxJBerAkNSBMbxL5mnng3JD.PNG"]}
created2022-02-16 05:59:09
last_update2022-02-16 05:59:09
depth0
children6
last_payout2022-02-23 05:59:09
cashout_time1969-12-31 23:59:59
total_payout_value11.842 HBD
curator_payout_value12.426 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,622
author_reputation11,066,014,147,515
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries
0.
accounthiveonboard
weight100
1.
accountocd
weight100
2.
accountstarstrings01
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,513,768
net_rshares21,840,228,696,706
author_curate_reward""
vote details (92)
@code-redex ·
Thank you very much brother, this was more than educative and the funny part is , i actually needed a very good image slider to complete my project but this solves it all! 

Thanks broo😊😊😊 
properties (22)
authorcode-redex
permlinkre-techlhab-r7e1on
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2022.01.2"}
created2022-02-16 08:17:12
last_update2022-02-16 08:17:12
depth1
children1
last_payout2022-02-23 08:17:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length189
author_reputation3,323,614,779,179
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,516,117
net_rshares0
@techlhab ·
u wlc @code-redex. And thanks for the nice comment 🀝. 
properties (22)
authortechlhab
permlinkre-code-redex-r7e3pv
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2022.01.2"}
created2022-02-16 09:01:09
last_update2022-02-16 09:01:09
depth2
children0
last_payout2022-02-23 09:01:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length54
author_reputation11,066,014,147,515
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,517,051
net_rshares0
@rufans ·
I found out about Swiprjs some days ago while searching for the best react carousel lib to use. I ended up using react-multi-carousel.
properties (22)
authorrufans
permlinkr7ivjp
categoryhive-139531
json_metadata{"app":"hiveblog/0.1"}
created2022-02-18 22:52:39
last_update2022-02-18 22:52:39
depth1
children0
last_payout2022-02-25 22:52:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length134
author_reputation101,081,674,466,198
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,600,977
net_rshares0
@starstrings01 ·
Wait, the code made the logo of hive?
properties (22)
authorstarstrings01
permlinkre-techlhab-r7dwhd
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2022.01.2"}
created2022-02-16 06:24:51
last_update2022-02-16 06:24:51
depth1
children1
last_payout2022-02-23 06:24:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length37
author_reputation942,630,974,283,386
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,514,077
net_rshares0
@techlhab ·
Thanks for commenting @starstrings01 🀝. Regarding your question, I downloaded the hive logo then linked it inside the HTML code using 
```
<img src="hive.png"/>
```
so has to have it displayed on the sliders.
properties (22)
authortechlhab
permlinkre-starstrings01-r7e3jo
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2022.01.2"}
created2022-02-16 08:57:27
last_update2022-02-16 08:57:27
depth2
children0
last_payout2022-02-23 08:57:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length208
author_reputation11,066,014,147,515
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,516,990
net_rshares0
@temibot ·
Wow this created the feeling of nostalgia in me @techlhab as I remembered when I was learning HTML as an intro to coding for me..πŸ˜‚
properties (22)
authortemibot
permlinkre-techlhab-r7e55o
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2022.01.2"}
created2022-02-16 09:32:30
last_update2022-02-16 09:32:30
depth1
children0
last_payout2022-02-23 09:32:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length130
author_reputation32,580,286,202,314
root_title"Detailed Explanation on How to Install and Use SwiperJS On any Frontend Frameworks or Web Applications| The Most Modern Touch Slider"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id110,517,693
net_rshares0