Basic Vanilla JavaScript Slider Carousel – slider.js

Category: Javascript , Slider | April 21, 2020
Author: esanazizi
Views Total: 1,978 views
Official Page: Go to website
Last Update: April 21, 2020
License: MIT


Basic Vanilla JavaScript Slider Carousel – slider.js


A really simple and auto-rotating image slider carousel implemented in vanilla JavaScript.

How to use it:

1. Load the slider.css in the head of the document.

<link rel="stylesheet" href="slider.css" />

2. Add images together with navigation controls to the slider.

<div class="slider">
  <div class="slider-images">
    <img class="active" src="1.jpg" alt="1">
    <img src="2.jpg" alt="2">
    <img src="3.jpg" alt="3">
    <img src="4.jpg" alt="4">
  <div class="slider-buttons">
    <a href="#" class="active">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>

3. Load the slider.js at the end of the document and everything is done.

<script src="slider.js"></script>

You Might Be Interested In:

Leave a Reply