Minimal Swiper/Carousel In Vanilla JavaScript

Category: Javascript , Slider | January 26, 2018
Author:msorce
Views Total:888 views
Official Page:Go to website
Last Update:January 26, 2018
License:MIT

Preview:

Minimal Swiper/Carousel In Vanilla JavaScript

Description:

This is a minimal, responsive carousel/swiper written in pure JavaScript that supports both touch swipe and mouse drag events.

How to use it:

Insert the stylesheet minimal-carousel.css and JavaScript minimal-carousel.js into the document.

<link rel="stylesheet" href="minimal-carousel.css">
<script src="minimal-carousel.js"></script>

Add slides to the swiper/carousel as these:

<div class="slider mslider">
  <div class="slider-panel">
    <a href="">
      <img src="1.jpg" alt="" />
    </a>
  </div>
  <div class="slider-panel">
    <a href="">
      <img src="2.jpg" alt="" />
    </a>
  </div>
  <div class="slider-panel">
    <a href="">
      <img src=3.jpg" alt="" />
    </a>
  </div>
  ...
</div>

Create a placeholder element for the pagination bullets. Done.

<div class="slider-pagination"></div>

You Might Be Interested In:


One thought on “Minimal Swiper/Carousel In Vanilla JavaScript

Leave a Reply