Pure Javascript Animated Customizable Range Slider | rSlider.js

Single/Range Slider Plugin is a pure JS library to dynamically render nice range sliders with custom scales, labels, and tooltips.

range slider image change, range slider with custom steps, html range slider with labels, responsive range slider javascript, range slider with scale

How to make use of it:

1. Add the rSlider.css style sheet and rSlider.js javascript to your HTML page.

<link rel="stylesheet" href="css/rSlider.min.css">
<script src="js/rSlider.min.js"></script>

2. Create a plain text input field for the range slider.

<input type="text" id="slider" class="slider">

3. Create a new range slider from the text field.

var mySlider = new rSlider({
    target: '#slider',
    values: [2008, 2009, 2010, 2011, ...],
    range: true // range slider
});

4. More configurations to customize the range slider.

var mySlider = new rSlider({
    target: '#slider',
    values: [2008, 2009, 2010, 2011, ...],
    range: true // range slider
    set:    null, // an array of preselected values
    width:    null,
    scale:    true,
    labels:   true,
    tooltip:  true,
    step:     null, // step size
    disabled: false, // is disabled?
    onChange: null // callback
});

5. API methods.

// Returns selected values.
mySlider.getValue();
// Disables the range slider
mySlider.disabled(true);
// Callback
mySlider.onChange(function (values) { 
  // argument values represents current values 
});
// Sets new values
mySlider.setValues(10, 20);
// Destroys the range slider
mySlider.destroy();

Configuration

targetSingle element’s class/id or HTML object e.g. document.getElementById(‘sampleSlider’)
valuesA flat array of values e.g. [1, 2, , 4, 5] or object e.g. {min: 1, max: 10}.
stepWhile using an object value {min: 0, max: 100} the step can be defined e.g. 10
rangeBoolean (true or false) to set if the slider is a range or single type (default false)
setA flat array of one (single slider) or two (range slider) values to set initial values (optional)
widthNumber or string value (e.g. 400 or ‘400px’) to set the slider width (optional). Default the closest parent div width is used.
scaleBoolean (true or false) to show or hide scale (default true).
labelsBoolean (true or false) to show or hide scale labels (default true).
tooltipBoolean (true or false) to show or hide tooltips (default true).
disabledBoolean (true or false) to disable/enable slider (default false).

Methods

Methods can be used after a new instance of slider is initiated e.g. slider.getValue();

getValue()Returns selected values.
disabled(true/false)Makes a slider disabled/enabled
onChange(callback)the callback function argument returns current selected values e.g
mySlider.onChange(function (values) { // argument values represents current values });
setValues(start, end)Method gets one (range: false) or two (range: true) parameters and sets the values (see example above).
destroy()Removes an instance of slider e.g. mySlider.destroy();

animated customizable range slider, single/range slider Plugin/Github


See Demo And Download

Official Website(slawomir-zaziablo): Click Here

This superior jQuery/javascript plugin is developed by slawomir-zaziablo. For extra advanced usage, please go to the official website.

Related Posts

Input-Values-Using-Mouse-Drag

Create Side Sliders Input Values Using Mouse Drag | Pointer Lock

HTML Range Slider is a lightweight library to create side sliders to adjust values easily and precisely by making use of the Pointer Lock API. Side Slider…

simple-parallax-scrolling-js

Smooth and Lightweight Parallax Scroll Library in Pure Javascript

Lightweight and seamless parallax scrolling library implemented in pure javascript using hardware acceleration for additional performance. Main Features Extremely lightweight with no dependencies A few kilobytes of pure…

Convert-Form-Data-to-JSON

How to Convert Form Data to JSON with HTML Forms | FormsJS

FormsJS is a simple-to-use JavaScript library that covers type subject values to JSON in real time. The items containing the data category will be analyzed automatically. It…

editable-html-table-using-javascript

A Small jQuery Extension to Convert An Editable HTML Table

Editable Table is a small jQuery extension to convert an editable HTML table for fast data entry and validation. A small jQuery extension to convert a static…

jquery.youtube-background

Simple jQuery Plugin for Embedding YouTube Videos As Cover Background

jquery.youtube-background is a jQuery plugin built to facilitate YouTube embeds as cover wallpaper using the YouTube Embed API. There is another jQuery Youtube Video Background plugin that…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…