New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mile-slider

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mile-slider

Carousel on vanilla JS with the possibility of customization

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

Mile slider

Simple, customizable, responsive carousel on vanilla JS. Demo

Install

npm install mile-slider

Usage

  • Add a link to the css file:
<link rel="stylesheet" href="https://unpkg.com/mile-slider@0.0.3/src/mile-slider.css">
  • Add HTML markup:
<div class="mile-slider" id="slider1">
  <button class="mile-slider__nav-button mile-slider__nav-button--left">←</button>
  <button class="mile-slider__nav-button mile-slider__nav-button--right">→</button>
  <div class="mile-slider__content">
    <div>
      <div>
        <img src="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1459716854666-062eac2da3bd?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjI5MzI0fQ&auto=format&fit=crop&w=889&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1437322213019-20ad95053704?ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1461703048574-9a342517f1bb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjF9&auto=format&fit=crop&w=889&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1441239372925-ac0b51c4c250?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1455487276747-341d543aa498?ixlib=rb-1.2.1&auto=format&fit=crop&w=755&q=80" alt="">
      </div>
      <div>
        <img src="https://images.unsplash.com/photo-1516655855035-d5215bcb5604?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80" alt="">
      </div>
    </div>
  </div>
</div>
  • Initialize slider in .js file:
import { mileSlider } from "./node_modules/mile-slider/src/mile-slider.js";

or

import { mileSlider } from "https://unpkg.com/mile-slider@0.0.3/src/mile-slider.js";
  • Call mileSlider():
mileSlider({
  container: 'slider1',
  animationDuration: 600,
  animationType: 'linear',
  height: 332,
  slidesToShow: 3,
  gap: 24,
  activeSlideStyles: {
    backgroundColor: '#6554C0',
    padding: '16px',
  }
});

Options

OptionTypeDescription
containerStringSlider container ID
animationDurationNumber (positive integer)Time in milliseconds between switching slides
animationTypeString (linear, ease, ease-in, ease-out, etc)Animation-timing-function
heightNumber (positive integer)Slider height
slidesToShowNumber (positive integer)Number of slides to scroll
gapNumber (positive integer)Gap between slides
activeSlideStylesObjectCSS styles for active slide

License

The MIT License.

Keywords

carousel

FAQs

Package last updated on 26 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts