jQuery UI Slider (setting programmatically)

前端 未结 12 1453
借酒劲吻你
借酒劲吻你 2020-12-02 15:04

I\'d like to modify the sliders on-the-fly. I tried to do so by using

$(\"#slider\").slider(\"option\", \"values\", [50,80]);

This call wil

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 15:54

    It's possible to manually trigger events like this:

    Apply the slider behavior to the element

    var s = $('#slider').slider();
    

    ...

    Set the slider value

    s.slider('value',10);
    

    Trigger the slide event, passing a ui object

    s.trigger('slide',{ ui: $('.ui-slider-handle', s), value: 10 });
    

提交回复
热议问题