0.1.6 • Published 6 years ago

rangeable v0.1.6

Weekly downloads
1,137
License
MIT
Repository
github
Last release
6 years ago

Rangeable

npm version license Average time to resolve an issue Percentage of issues still open npm.io npm.io

A dependency-free, responsive and touch-enabled vanilla javascript range slider to make <input type="range"> elements prettier and more configurable.

  • No dependencies
  • 3kb gzipped
  • Touch enabled
  • Responsive
  • Single or double range layouts.
  • Horizontal and vertical orientations.
  • Fully stylable to fit your app.

Rangeable

Rangeable is still in active development and therefore the API is in constant flux until v1.0.0. Check back regularly for any changes and make sure you have the latest version installed.

Live Demos


Install

npm

npm install rangeable --save

Browser

Grab the files from one of the CDNs and include them in your page:

https://unpkg.com/rangeable@latest/dist/rangeable.min.css
https://unpkg.com/rangeable@latest/dist/rangeable.min.js

You can replace latest with the required release number if needed.


Default

Create a new instance:

const rangeable = new Rangeable(input, {
    type: "single",
    tooltips: "always",
    min: 0,
    max: 100,
    step: 1,
    value: 50,
    vertical: false,
    handle: undefined,
    handles: undefined,
    onInit: function() {
        // do something when the instance has loaded
    },
    onStart: function() {
        // do something on mousedown/touchstart
    },
    onChange: function() {
        // do something when the value changes
    },
    onEnd: function() {
        // do something on mouseup/touchend
    },
    classes: {
        input: "rangeable-input",
        container: "rangeable-container",
        vertical: "rangeable-vertical",
        progress: "rangeable-progress",
        handle: "rangeable-handle",
        tooltip: "rangeable-tooltip",
        track: "rangeable-track",
        multiple: "rangeable-multiple",
    }
});

You can pass either a reference to the input or a CSS3 selector string:

const myRangeInput = document.getElementById('myRangeInput');
const rangeable = new Rangeable(myRangeInput);

// or

const rangeable = new Rangeable('#myRangeInput');

Options

See Options


Public Methods

See Public Methods


Copyright © 2018 Karl Saunders | BSD & MIT license

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago