An open API service indexing awesome lists of open source software.

https://github.com/ninjaprox/segmented-slider-js

A simple slider with three segments
https://github.com/ninjaprox/segmented-slider-js

Last synced: over 1 year ago
JSON representation

A simple slider with three segments

Awesome Lists containing this project

README

          

segmented-slider-js
===================

# Introduction

segmented-slider-js is a simple slider with three segments.

That's all. No more words. Just use it.

# Demo
[Have a look](http://ninjaprox.github.io/demo/segmented-slider-js/)

# Requirements

* jQuery
* jQuery.event.drag

This control uses `jQuery` and `jQuery.event.drag` as dragging stuff helper.

Therefore, make sure these two libraries are imported already.

You can learn more jQuery.event.drag [here](http://threedubmedia.com/code/event/drag)

# Usage

## HTML

Firstly, you need to create a skeleton for this control.

```html



  • 0

  • 10

  • 20

  • 30

  • 40

  • 50

  • 60

  • 70

  • 80

  • 90

  • 100










```

`data-init-green` and `data-init-amber` attributes are to set the initial position of the green and amber handle.

Unless they are set, the control itself has default value.

## Javascript

```js
$(".segmented-slider").segmentedSlider(function(greenPoint, amberPoint) {
// Do your stuff with new green point and amber point value here

/* Example
$(".handle.green").text(greenPoint);
$(".handle.amber").text(amberPoint);
*/
});
```
# Todo

* Make it responsive

# License

The MIT License (MIT)

Copyright (c) 2015 Nguyen Vinh [@ninjaprox](http://twitter.com/ninjaprox)