Friday, August 30, 2013

JQuery UI slider with more than 2 handles

$('#slider').slider({min: 1, max: 100, values: [0, 3, 15, 25],
    slide: function(event, ui) {
        var index = $(ui.handle).siblings('a').andSelf().index(ui.handle);
        var values = $(this).slider('values');
        return (index == 0 || ui.value > values[index - 1]) &&
            (index == values.length - 1 || ui.value < values[index + 1]);
    },
    stop: function( event, ui ) {
        alert("VAL 1=" + ui.values[0] + "/n" + "VAL 2=" + ui.values[1] + "/n" +"VAL 3=" + ui.values[2] + "/n" +"VAL 4=" + ui.values[3] + "/n");
    }
})

No comments:

Post a Comment