Skip to content

Lightweight rangeslider with touch support // vertical mode added

License

Notifications You must be signed in to change notification settings

raxuk/rangeslider-js

 
 

Repository files navigation

rangeslider-js

Build Status Inline docs Dependency Status

Simple, fast and lightweight slider, touch friendly

Forked from: https://github.com/stbaer/rangeslider-js

Docs and Examples

  • v1 was based on rangeslider.js, main differences:
    • no jQuery
    • raf to throttle window resize, transform to set the handle position
    • fewer and only basic styles

Install

npm i rangeslider-js --save

Usage

<input id="slider1" type="range">

<input id="slider2" type="range" min="0" max="5" value="1" step="1">

Vertical mode:

<input id="slider1" type="range" class="vertical">
import rangesliderJs from 'rangeslider-js'

// single, options via js 
rangesliderJs.create(document.getElementById('slider1'), {min:0, max: 1, value: 0.5, step: 0.1})

// or single, options via html attributes 
rangesliderJs.create(document.getElementById('slider2'))

// or initialize multiple
rangesliderJs.create(document.querySelectorAll('input[type="range"]'))

Options

{
    min: 0,
    max: 100,
    value: 50,
    step: 1,
    vertical: true,
    // callbacks
    onInit: (value, percent, position) => {},
    onSlideStart: (value, percent, position) => {},
    onSlide: (value, percent, position) => {},
    onSlideEnd: (value, percent, position) => {}
}

Events

Contribute or Report Issue

Pull requests should target the develop branch.

For bugs and feature requests, please create an issue.

Licence

MIT, see LICENSE.md for details.

About

Lightweight rangeslider with touch support // vertical mode added

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.3%
  • HTML 13.8%
  • CSS 3.9%