jQuery UI Slider (setting programmatically)

前端 未结 12 1486
借酒劲吻你
借酒劲吻你 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:43

    For me this perfectly triggers slide event on UI Slider :

    hs=$('#height_slider').slider();
    hs.slider('option', 'value',h);
    hs.slider('option','slide')
           .call(hs,null,{ handle: $('.ui-slider-handle', hs), value: h });
    

    Don't forget to set value by hs.slider('option', 'value',h); before the trigger. Else slider handler will not be in sync with value.

    One thing to note here is that h is index/position (not value) in case you are using html select.

提交回复
热议问题