I have a two handle jQuery UI Slider, under each handle of it, there's a number that should change everytime user changes the handles, I can only change one of them.
I need to detect which handle has been moved, and in which direction it has moved, to calculate the numbers.
HTML:
<div id="slider-range"></div>
<div id="amount">
<span class="minslider"><span class="minprice">0</span> Dollar</span>
<span class="maxslider"><span class="maxprice">3000000</span> Dollar</span>
</div>
jQuery:
$(function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 15,
values: [ 0, 15 ],
step: 1,
change: function( event, ui ) {
var maxprice = $('.maxprice').text();
var oneslice = Math.round(maxprice / 15);
var finalprice = maxprice - oneslice;
$('.maxprice').text(finalprice);
}
})
});