GithubHelp home page GithubHelp logo

bekirozyurt / elessar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quarterpast/elessar

0.0 2.0 0.0 6.27 MB

Draggable multiple range sliders

Home Page: http://quarterto-archive.github.io/Elessar

License: MIT License

Makefile 0.94% CSS 3.74% JavaScript 95.33%

elessar's Introduction

Unmaintained

I do not have time or inclination to work on Elessar. Do not expect me to respond to your issues or pull requests.

Elessar

Build Status npm ![Gitter](https://badges.gitter.im/Join Chat.svg) PayPal

Browser Matrix

Draggable multiple range sliders elessar draggable range demo

Installation

Elessar is available via npm and Bower, and as standalone files:

npm install elessar bower install elessar

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: [], // array of value pairs; each pair is the min and max of the range it creates
  readonly: false, // whether this bar is read-only
  min: 0, // value at start of bar
  max: 100, // value at end of bar
  valueFormat: function(a) {return a;}, // formats a value on the bar for output
  valueParse: function(a) {return a;}, // parses an output value for the bar
  snap: 0, // clamps range ends to multiples of this value (in bar units)
  minSize: 0, // smallest allowed range (in bar units)
  maxRanges: Infinity, // maximum number of ranges allowed on the bar
  bgMarks: {
    count: 0, // number of value labels to write in the background of the bar
    interval: Infinity, // provide instead of count to specify the space between labels
    label: id // string or function to write as the text of a label. functions are called with normalised values.
  },
  indicator: null, // pass a function(RangeBar, Indicator, Function?) Value to calculate where to put a current indicator, calling the function whenever you want the position to be recalculated
  allowDelete: false, // set to true to enable double-middle-click-to-delete
  deleteTimeout: 5000, // maximum time in ms between middle clicks
  vertical: false, // if true the rangebar is aligned vertically, and given the class elessar-vertical
  bounds: null, // a function that provides an upper or lower bound when a range is being dragged. call with the range that is being moved, should return an object with an upper or lower key
  htmlLabel: false, // if true, range labels are written as html
  allowSwap: true // swap ranges when dragging past
});

API

.val()

Returns array of pairs of min and max values of each range.

bar.val(); //=> [[0,20], [34,86]]

.val(values)

Updates the ranges in the bar with the values. Returns the bar, for chaining.

bar.val([[0,30], [40,68]]); //=> bar: RangeBar

.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

elessar's People

Contributors

apaleslimghost avatar gitter-badger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.