Skip to content
the poor coder

Slider javascript vertical

Poor Man
Published
Reading time
1 min read

Slider Javascript Vertical#

If you are looking to create a vertical slider in your webpage, you can do it easily with Javascript. There are different Javascript libraries available that you can use to create a vertical slider, but here we will use the Swiper library to create a simple vertical slider.

Steps to create a vertical slider using Swiper#

  1. Add the Swiper library to your webpage:
HTML
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
  1. Create a container for your slider:
HTML
<div class="swiper-container">
  <!-- Slides -->
</div>
  1. Add the slides inside the container:
HTML
<div class="swiper-container">
  <div class="swiper-wrapper">
    <div class="swiper-slide">
      Slide 1
    </div>
    <div class="swiper-slide">
      Slide 2
    </div>
    <div class="swiper-slide">
      Slide 3
    </div>
  </div>
</div>
  1. Initialize the Swiper slider with the following code:
HTML
<script>
  var swiper = new Swiper('.swiper-container', {
    direction: 'vertical',
    slidesPerView: 1,
    spaceBetween: 30,
    mousewheel: true,
    pagination: {
      el: '.swiper-pagination',
      clickable: true,
    },
  });
</script>

The above code initializes the Swiper slider with vertical direction, one slide per view, 30 pixels space between slides, mousewheel enabled for scrolling, and pagination dots for navigation.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC