All Projects → sampotts → Rangetouch

sampotts / Rangetouch

Licence: mit
A super tiny library to make `<input type='range'>` sliders work better on touch devices

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Rangetouch

react-simple-range
🔉 React slider component for inputting a numeric value within a range.
Stars: ✭ 20 (-91.07%)
Mutual labels:  input, slider, range
Input Range Scss
Styling Cross-Browser Compatible Range Inputs with Sass
Stars: ✭ 272 (+21.43%)
Mutual labels:  input, range
AORangeSlider
AORangeSlider is a custom UISlider with two handlers to pick a minimum and a maximum range.
Stars: ✭ 82 (-63.39%)
Mutual labels:  slider, range
React Slider Kit
react-slider-kit is going to be a comprehensive solution to slider feature in react.
Stars: ✭ 219 (-2.23%)
Mutual labels:  slider, range
vue-histogram-slider
Range slider with histogram for Vue.js
Stars: ✭ 111 (-50.45%)
Mutual labels:  slider, range
range-slider
Customizable slider (range) component for JavaScript with no dependencies
Stars: ✭ 26 (-88.39%)
Mutual labels:  slider, range
numberbox-card
Replace input_number sliders with plus and minus buttons
Stars: ✭ 61 (-72.77%)
Mutual labels:  input, slider
Angular Datetime Range
📅 Angular directive for datetime range input
Stars: ✭ 27 (-87.95%)
Mutual labels:  input, range
Vue Ctk Date Time Picker
VueJS component to select dates & time, including a range mode
Stars: ✭ 707 (+215.63%)
Mutual labels:  input, range
React Slider
Accessible, CSS agnostic, slider component for React.
Stars: ✭ 627 (+179.91%)
Mutual labels:  slider, range
TimeRangePicker
A customizable, easy-to-use, and functional circular time range picker library for Android. Use this library to mimic Apple's iOS or Samsung's bedtime picker.
Stars: ✭ 266 (+18.75%)
Mutual labels:  slider, range
Rangeseekbar
A beautiful and powerful SeekBar what supports single、 range、steps、vetical、custom( 一款美观强大的支持单向、双向范围选择、分步、垂直、高度自定义的SeekBar)
Stars: ✭ 2,037 (+809.38%)
Mutual labels:  slider, range
jquery-rsSliderLens
UI slider control that magnifies the current value
Stars: ✭ 20 (-91.07%)
Mutual labels:  input, range
React Range
🎚️Range input with a slider. Accessible. Bring your own styles and markup.
Stars: ✭ 545 (+143.3%)
Mutual labels:  slider, range
Range Slider
The simplest JavaScript custom range slider ever!
Stars: ✭ 41 (-81.7%)
Mutual labels:  slider, range
Ion.rangeslider
jQuery only range slider
Stars: ✭ 2,494 (+1013.39%)
Mutual labels:  slider, range
Voice Overlay Android
🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI
Stars: ✭ 189 (-15.62%)
Mutual labels:  input
React Code Input
React component for entering and validating PIN code.
Stars: ✭ 207 (-7.59%)
Mutual labels:  input
Selectize.js
Selectize is the hybrid of a textbox and <select> box. It's jQuery based, and it has autocomplete and native-feeling keyboard navigation; useful for tagging, contact lists, etc.
Stars: ✭ 12,744 (+5589.29%)
Mutual labels:  input
Angular Bootstrap Slider
an angularjs directive for seiyria-bootstrap-slider
Stars: ✭ 183 (-18.3%)
Mutual labels:  slider

RangeTouch

A super tiny library to make <input type="range"> sliders work better on touch devices.

Donate - Demo - npm version

Why bother?

While building the Plyr media player I noticed how bad the experience was trying to use <input type="range"> is on a touch device (particularly iOS). Touching the track on a desktop will jump the thumb handle to that point. However on some touch devices this simply focuses the input and to adjust the value you need to touch and drag the handle. This is something that I can't help but feel will eventually be fixed by the browser vendors but for now, you can use RangeTouch to fill that gap.

Features

  • ~1KB minified and gzipped
  • No dependencies (written in "vanilla" JavaScript)
  • Uses event delgation so no need to re-run after DOM manipulation

Quick setup

1. Include the lib

Either use the ES6 module:

import RangeTouch from 'rangetouch';

...or include the script:

<script src="https://cdn.rangetouch.com/2.0.1/rangetouch.js"></script>

2. Create instance(s)

Single instance

const range = new RangeTouch('input[type="range"]', { ...options });

The first argument can either be:

The second argument is for options.

This will return a reference to the single instance.

Multiple instances

To setup multiple inputs at one time, you can use the following static method:

const ranges = RangeTouch.setup('input[type="range"]', { ...options });

The first argument can either be:

The second argument is for options.

This will return an array of RangeTouch instances that it setup.

Options

Property Type Default Description
addCSS Boolean true Whether to inject CSS to improve the usability of the inputs. It's recommended you add this yourself if you don't want RangeTouch to take care of it.
thumbWidth Integer 15 This value is used as part of the calculation to determine the value the users selects when touching the range track. Unfortunately as JavaScript can't access the shadow DOM, this value can't be automatically determined. I would recommend customisation (and setting the size of the thumb) given all OS and browser combinations seem to render the control differently.
watch Boolean true Watch for new elements added to the DOM that match your string selector. Note: This only applies when using the multiple instance RangeTouch setup method and also requires a string selector as the first argument.

API

Method Arguments Description
destroy() N/A Destroy the current instance and remove event listeners.

To call an API method, you need a reference to the instance. For example:

const range = new RangeTouch('input[type="range"]', { ...options });
range.destroy();

Issues

If you find anything weird with RangeTouch, please let us know using the GitHub issues tracker and be descriptive on how to reproduce, expected result, the browser (and version) used, etc.

Author

RangeTouch is developed by @sam_potts / sampotts.me

Donate

RangeTouch costs money to run for domains, hosting and more. Any help is appreciated... Donate to support RangeTouch

Thanks

Fastly

Thanks to Fastly for providing the CDN services.

Copyright and License

The MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].