You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

js-rangeslider

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-rangeslider

A vanilla js range Slider utility handling dual inputs

1.0.6
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

RangeSlider

Installation

npm install js-rangeslider

Usage

Add HTML-Elements of class "rangeSlider" to your markup first:

<div class="rangeSlider" data-min="0" data-max="100" data-step="1" data-vmin="20" data-vmax="80"></div>

Import rangeSlider as needed:

import Styles from "js-rangeslider/src/js-rangeslider"
import RangeSlider from "js-rangeslider/src/js-rangeslider"

new RangeSlider(document.querySelector(".rangeSlider"))

If you want to override the default styling, use scss to override the default values before importing:

// custom-rangeslider-styles.scss
$barBackground: #dedede;
$handleBackground: #444444;
$progressBackground: #c00;

@import "js-rangeslider/src/js-rangeslider";

Options

Initialize your rangeSlider using an Object with some or all of these options:

NameTypeDefaultDescription
minNumber0The absolute minimum of your rangeSlider
maxNumber100The absolute maximum of your rangeSlider
minInputNameString"min"The name of the input holding the minimum-value, might be important when using server-side input-processing
maxInputNameString"max"The name of the input holding the maximum-value, might be important when using server-side input-processing
minInputValueNumber0The current minimum-value
maxInputValueNumber100The current maximum-value
stepNumber1The value between each separate step of your range
outputFormatterFunctionoutput => `${output} &euro;`A function accepting the current output as a parameter and returning a formatted string to output
progressBooleantrueWether or not a progress bar between each of the rangeSlider-handles will be rendered
outputBooleantrueWether or not two output-fields will be rendered on the bottom left and right ends of your rangeSlider

Keywords

range

FAQs

Package last updated on 05 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts