在<input />范围拇指中输入值

时间:2018-02-08 01:51:03

标签: javascript html css

我想将输入范围值放入拇指。我已经看到它有可能但是没有看到代码。 谁能提供一个例子? 我想做这样的事情:Picture example

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Slider - Custom handle</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #custom-handle {
    width: 3em;
    height: 1.6em;
    top: 50%;
    margin-top: -.8em;
    text-align: center;
    line-height: 1.6em;
  }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    var handle = $( "#custom-handle" );
    $( "#slider" ).slider({
      create: function() {
        handle.text( $( this ).slider( "value" ) );
      },
      slide: function( event, ui ) {
        handle.text( ui.value );
      }
    });
  } );
  </script>
</head>
<body>
 
<div id="slider">
  <div id="custom-handle" class="ui-slider-handle"></div>
</div>
 
 
</body>
</html>
&#13;
&#13;
&#13;