Automatic Responsive Image Slider In Vanilla JavaScript – air-slider

Category: Javascript , Slider , Slideshow | April 25, 2017
Author: nueq22
Views Total: 9,038 views
Official Page: Go to website
Last Update: April 25, 2017
License: MIT

Preview:

Automatic Responsive Image Slider In Vanilla JavaScript – air-slider

Description:

air-slider is a simple pure JavaScript plugin to creating a cross-fading image slider/slideshow that automatically adjusts the image’s size when the window changes.

How to use it:

Add the air-slider’s stylesheet and JavaScript files to your html page.

<link rel="stylesheet" href="air-slider.min.css">
<script src="air-slider.min.js"></script>

Add your own images as slides to the slider.

<div class="air-slider">
  <div class="slide">
    <img src="1.jpg" alt="slide1"/>
  </div>
  <div class="slide">
    <img src="2.jpeg" alt="slide2"/>
  </div>
  <div class="slide">
    <img src="3.jpeg" alt="slide3"/>
  </div>
</div>

Initialize the image slider by creating a new airSlider object just like this:

var slider = new airSlider({
    // options go here
});

Config the slider whatever you like:

var slider = new airSlider({

    // enable autoplay
    autoPlay: true,

    // autoplay interval
    autoPlayTime: 3000,

    // slider size
    width: '600px',
    height: '300px'
    
});

You Might Be Interested In:


2 thoughts on “Automatic Responsive Image Slider In Vanilla JavaScript – air-slider

  1. Will

    Hi there and nice job bro!
    i would like to add a pause fonction on this script (autoPlay: pause) with a button of course…
    can you help me pls?
    thks.

    Reply

Leave a Reply