jquery-nstslider

jquery.nstSlider.js -------

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
jquery-nstslider
1.0.410 years ago10 years agoMinified + gzip package size for jquery-nstslider in KB

Readme

jquery.nstSlider.js

Fully customizable with CSS, Single/Double handles, Touch-enabled, IE 7+ Compatibility, Custom Digit Rounding, Non linear step increments!
Build Status

Example

Initialize with:
$(".mySlider").nstSlider({
    "left_grip_selector": ".leftGrip",
    "right_grip_selector": ".rightGrip",
    "value_bar_selector": ".bar",
    "value_changed_callback": function(cause, minValue, maxValue, prevMinValue, prevMaxValue) {
        // show the suggested values in your min/max labels elements
    }
});
 ```

Destroy with:

```javascript
$(".mySlider").nstSlider('teardown');

Demo

For live demos please visit the project webpage:
http://lokku.github.io/jquery-nstslider/
For a Quick Start have a look at the source html of the following file:
https://github.com/lokku/jquery-nstslider/blob/master/demo/index.html

Options

Option | Type | Default | Description ------ | ---- | ------- | ----------- animatingcssclass | string | nst-animating | the css class to be used when the slider is to be animated (this happens when a certain min/max value is being set for example). touchtolerancevaluebarx | number | 15 | the horizontal tolerance in pixels by which a handle of the slider should be grabbed if the user touches outside the slider bar area. touchtolerancevaluebary | number | 30 | the vertical tolerance in pixels by which a handle of the slider should be grabbed if the user touches outside the slider bar area. leftgripselector | string | .nst-slider-grip-left | the selector of the left grip handle. The left grip element must exist in the page when the slider is initialized. rightgripselector | string | undefined | the selector of the right grip handle. This is optional. A single handler bar is assumed if this selector is not specified. valuebarselector | string | undefined | the selector of the value bar. If not specified assumes a value bar representing the selection is not wanted. rounding | object or number | 1 | the rounding for a certain value displayed on the slider. This rounds the values returned in the valuechangedcallback as roundedValue : int(actualValue / rounding) rounding. The rounding parameter can be a number (i.e., fixed rounding) or can depend on actualValue (i.e., dynamic rounding). To perform dynamic rounding an object must be passed instead of a value. For example, passing rounding : { '1' : '100', '10' : '1000', '50' : '10000' } will use rounding = 1 when actualValue <= 100, rounding = 10 when 100 < actualValue <= 1000 and so on... valuechangedcallback | function | function(cause, curMin, curMax, prevMin, prevMax) { return; } | a callback called whenever the user drags one of the handles. usermouseupcallback | function | function(vmin, vmax, leftgripmoved) { return; } | a callback called whenever the mouse button pressed while dragging a slider grip is released userdragstartcallback | function | function () { return; } | a callback called before the user drags one of the handles

Methods

Method | Argument | Description ------ | -------- | ----------- get
rangemin | None | return the current minimum range of the slider getrangemax | None | return the current maximum range of the slider getcurrentminvalue | None | return the current minimum value of the slider getcurrentmaxvalue | None | return the current maximum value of the slider ishandletoleftextreme | None | return a boolean indicating whether or not the left handler is moved all the way to the left ishandletorightextreme | None | return a boolean indicating whether or not the right handler is moved all the way to the right refresh | None | force a refresh of the slider disable | None | disable the slider (i.e., user cannot move the handles) enable | None | enable the slider (i.e., user can move the handles) isenabled | None | return a boolean indicating whether or not the slider can be moved by the user setposition | min: number, max: number | set the handles at the specified min and max values setstephistogram | histogram : array of numbers | use a non-linear step increment for the slider that is stretched where the histogram provided counts more items unsetstephistogram | None | use a linear scale of increments for the slider setrange | rangeMin : number, rangeMax : number | set the minimum and the maximum range of values the slider setrounding | rounding: number or object | set the rounding for the slider getrounding | None | return the current rounding of the slider teardown | None | remove all data stored in the slider

Dependencies

jQuery 1.6.4+

License

Copyright (c) 2014 Lokku Ltd.
Licensed under the MIT license.