The NoUISlider is a great working plugin, however I would like the tooltips to not overlap each other. I have the following which works, except for the overlapping tooltips.
$("#slider").noUiSlider({
range: { min: 0, max: 100 },
step: 5,
connect: true,
start: [ 20, 50 ]
});
$("#slider").Link('lower').to('-inline-<div class="tooltip"></div>', function(value){
$(this).text( "From: "+value );
});
$("#slider").Link('upper').to('-inline-<div class="tooltip"></div>', function(value){
$(this).text( "From: "+value );
});
http://jsfiddle.net/q5651786/2/
I am thinking something like this would be nice: http://ionden.com/a/plugins/ion.rangeSlider/demo.html
Anyone got a clue?
Based on the difference between the lower and upper values, hide one of the tooltips and make the other tooltip show both the values. (and of course make few changes in the styling to position them correctly).
Also, I hardcoded the value at which tooltips would become one, which is the when difference is <= 5. Because at that value it looks like the tooltips are overlapping. You can come up with your own magic number. (Some styling changes would be required too).
sliders outputs an array with lower and upper values [20.0, 40.0]
get the reference of other tooltip using .not()
if the difference between the values is <= 5 (magic number for overlapping tooltips) hide the other tooltip and show both the lower and upper values.
if the tooltips are far apart, then show the other tooltip and reset the css and display respective upper and lower values
The function would look like this overall
DEMO
http://jsfiddle.net/dhirajbodicherla/q5651786/4/
Hope this helps