JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://refreshless.com/nouislider/source/distribute/jquery.nouislider.all.min.js"></script>
<link rel="stylesheet" href="http://refreshless.com/nouislider/source/distribute/jquery.nouislider.pips.min.css">
<input type="text" id="annual-sales">
<div class="slider-wrap">
<div class="range-slider-sales-vol"></div>
</div>
<div>Input value: <span class="input-value"></span></div>
CSS
.slider-wrap { margin: 50px }
JavaScript
// The first number in the array represents the range. Between the 4 options below I have a range from 1000 - 1000000.
// The second number represents the stepped increments within the given range. From the first to second range the stepped increments are 1000.
var range_all_sliders = {
'min': [ 1000, 1000 ],
'33%': [ 100000, 50000 ],
'66%': [ 500000, 100000 ],
'max': [ 1000000 ]
}, slider = $('.range-slider-sales-vol');
slider.noUiSlider({
start: [ 1000 ],
range: range_all_sliders,
format: wNumb({
decimals: 0
})
});
// Pips plugin for points along range slider
$('.range-slider-sales-vol').noUiSlider_pips({
mode: 'positions',
values: [0,33,66,100],
density: 4,
stepped: true
});
var annualSales = $('#annual-sales'), guard = false, inputValue = $('.input-value');
function setSalesValue(value){
if ( guard ) return;
$(this).val(value);
inputValue.text(value);
}
annualSales.change(function(){
var value = $(this).val();
guard = true;
slider.val(value);
inputValue.text(value);
guard = false;
});
// links range slider to input
$('.range-slider-sales-vol').Link("lower").to(annualSales, setSalesValue);