0

我希望禁用 jQuery UI 滑块的功能,直到选中单选按钮。非常直截了当,但我尝试过的事情没有任何运气,所以我希望得到一些帮助。为方便起见:http: //jsfiddle.net/nlem33/L5cY6/11/

    $('#slider1').slider({

    min: min_value,
    max: max_value,
    step: 1,

    slide: sliderHandler,
    stop: function (event, ui) {

    }
});

var min_value = 0;
var max_value = 630;

$('#slider2').slider({

    min: min_value,
    max: max_value,
    step: 5,

    slide: sliderHandler,
    stop: function (event, ui) {

    }

});

4

1 回答 1

0

您可以将它们初始化为禁用,然后在单击单选按钮时启用它们:

$('#slider1').slider({

        min: min_value,
        max: max_value,
        step: 1,
        disabled: true, // <= disabled on init
        slide: sliderHandler,
        stop: function (event, ui) {

    }
});


// Enable function :

$(':radio').click(function() {
    $('#slider1, #slider2').slider('enable');
});

http://jsfiddle.net/L5cY6/23/

于 2013-04-22T16:26:11.377 回答