Elessar


Draggable multiple range sliders

Installation
Elessar is available via npm and Bower, and as standalone files:
Elessar requires jQuery. If you're using npm or Bower, it's installed as part of this step. If not: a) why not? they're pretty sweet, b) download it, and I assume you're just using <script>
tags, so just add a <script>
tag.
Using
Elessar exports as a CommonJS (Node) module, an AMD module, or a browser global:
var RangeBar = require('elessar');
require(['elessar'], function(RangeBar) { ... });
<script src="path/to/elessar.js"></script>
Create a rangebar with var rangeBar = new RangeBar
then add rangeBar.$el
to the DOM somewhere.
Options
new RangeBar({
values: [],
readonly: false,
min: 0,
max: 100,
valueFormat: function(a) {return a;},
valueParse: function(a) {return a;},
snap: 0,
minSize: 0,
maxRanges: Infinity,
bgMarks: {
count: 0,
interval: Infinity,
label: id
},
indicator: null,
allowDelete: false,
deleteTimeout: 5000,
vertical: false,
bounds: null,
htmlLabel: false,
allowSwap: true
});
API
.val()
Returns array of pairs of min and max values of each range.
bar.val();
.val(values)
Updates the ranges in the bar with the values. Returns the bar, for chaining.
bar.val([[0,30], [40,68]]);
.on('changing' function(values, range))
Event that triggers constantly as the value changes. Useful for reactively triggering things in your UI. Callback is passed the current values of the ranges and the range element that is changing.
.on('change' function(values, range))
Event that triggers after the user has finished changing a range. Useful for updating a Backbone model. Callback is passed the current values of the ranges and the range element that has changed.
Licence
MIT