Getting Started
Install
tnpm install slider-js --save
Usage
import from 'slider-js/src/index_css.js'
import Slider from 'slider-js'
Samples
Initializing:
<div style="overflow: hidden; width:200px; height: 200px;">
<ul id="slider" style="height: 100%;">
<li style="width:100%;height:100%;">a slider item</li>
<li style="width:100%;height:100%;">a slider item</li>
<li style="width:100%;height:100%;">a slider item</li>
</ul>
</div>
var slider = new Slider(document.getElementById('slider'));
slider.play();
Auto-slide && use gesture to slide:
var slider = new Slider(document.getElementById('slider'), {
autoplay: true,
useGesture: true
});
slider.play();
Do something when change:
slider.addEventListener('change', {curItem, nextItem, prevItem} => {
// TODO
})