I\'m trying to find a way to disable the click on my jQuery UI Slider\'s track. Clicking on the handle is ok but I do not want the handle to respond if the user clicks on t
@btate has the right idea (abandoning mousedown/touchstart that don't originate in the slider handle), but there is an easier way to get there. jQuery's event object will tell you which element initiated the event.
var sliderMouseDown = function (e) { // disable clicks on track
var sliderHandle = $('#navScroller').find('.ui-slider-handle');
if (e.target != sliderHandle[0]) {
e.stopImmediatePropagation();
}
};
$('#navScroller')
.on('mousedown', sliderMouseDown)
.on('touchstart', sliderMouseDown)
.slider({
value: 0,
start: onNavScrollStart,
slide: onNavScrollSlide,
animate: slideSpeed,
max: slideWidth
});