关于设置 UI 不透明度量滑块的问题

Issue on Setting UI Slider For Opacity Amount

你能看一下 this jsfiddle 并告诉我如何使用滑块获取从 01 的值,例如 0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1

这是我的

$(function() {
    $( "#slider" ).slider({
      value:1,
      min: 0,
      max: 1,
      step: 10,
      slide: function( event, ui ) {
        $( "#opacity" ).val( ui.value );
      }
    });
    $( "#opacity" ).val( $( "#slider" ).slider( "value" ) );
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<p>
  <label for="amount">Opacity:</label>
  <input type="text" id="opacity" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
 
<div id="slider"></div>

你的步长值太大,试试:

$( "#slider" ).slider({
    value:1,
    min: 0,
    max: 1,
    step: 0.1,
    slide: function( event, ui ) {
      $( "#opacity" ).val( ui.value );
    }
 });

jsfiddle demo


New fiddle demo