andreruffert / rangeslider.js

🎚 HTML5 input range slider element jQuery polyfill
https://rangeslider.js.org
MIT License
2.16k stars 398 forks source link

Reverse slider direction #286

Open joelworsham opened 7 years ago

joelworsham commented 7 years ago

Is it possible? For me specifically, I want to reverse the vertical direction so the top of the slider is the smallest value and the bottom is the highest value.

PardeepWildnet commented 7 years ago

Same in case of HORIZONTAL direction , is it possible to reverse the order from right to left ?

joelworsham commented 7 years ago

I found a workaround. Set a hidden input as the input whose value is used, and then simply update that input value onInit and onSlide like so:

onSlide: function (position, value) {

  let $altInput = $('#alt-input');
  let newValue  = this.max - this.value + this.min;

  $altInput.val(newValue);
}
NayanKhedkar commented 7 years ago

@joelworsham yes,it is possible.This feature has been implemented in PR:https://github.com/andreruffert/rangeslider.js/pull/245