jquery ui slider绑定选择步长0.5

时间:2015-12-18 02:14:00

标签: javascript



    $(".needSlider").each(function() {
       var select = $(this);
        var slider = $("<div id='slider'></div>").insertAfter(select).slider({
          min: 1,
          max: 99,
          step:0.5,
          range: "min",
          value: select[0].selectedIndex + 1,
          slide: function( event, ui ) {
            select[0].selectedIndex = ui.value - 1;
          }
        });
        select.change(function() {
          slider.slider("value", this.selectedIndex + 1);
       });
    });
&#13;
<select id="minbeds1" class="needSlider">
          <option value="1">1</option>
          <option value="1.5">1.5</option>
          <option value="2">2</option>
          <option value="2.5">2.5</option>
          <option value="3">3</option>
          <option value="3.5">3.5</option>
          <option value="4">4</option>
          <option value="4.5">4.5</option>
          <option value="5">5</option>
    </select>
&#13;
&#13;
&#13;

我在步骤0.5遇到问题,当我选择选择40.5或4.5我在控制台中有错误语法错误,无法识别的表达式:选项[值= 41.5]

0 个答案:

没有答案