0.0.1 • Published 7 years ago

slider-input v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Slider Input

A slider input UI implement. Demo

Usage

Include the script and style in your web page or install from npm first.

npm install --save slider-input

HTML:

<div id="my-slider"></div>

JavaScript:

var mySlider = new Slider(mySlider, config);

config is an Object and contains attributes below(optional):

OptionDescriptionDefault
initThe initial value of the slider0
totalThe maximum value of the slider100
stepThe size of each movementfalse (no step)
loopWhether the slider loops(Att. If configured true, this will conflict with swipeLeft and swipeRight options and disable them. )false
swipeLeftThe callback function after the slider is totally swiped left(Att. The slider will not be swiped away when loop is enabled. )null
swipeRightThe callback function after the slider is totally swiped right(Att. The slider will not be swiped away when loop is enabled. )null
onChangeThe callback function when the value of the sider has changedan empty function
colorsThe colors of the user interface. If configured, it must be an array of two functions, which take a ratio between 0 and 1 as input, and return a valid css color expressionAn array of two functions returning #ccc and #333

Detailed usage can be find easily from the source code of the Demo.