如何缩放高度数字微调器(输入类型=“ number”)

时间:2018-09-05 00:07:34

标签: html css input

因此,我正在设计一个网站,该网站需要使用大型微调器来输入数字,并且使用大字体使它变得很高(以此代码为例):

<input type="number" name="number" style="width: 100%; height: 110px; font-size: 100px;">

large spinner

如您所见,增加和减少数量的侧面上的两个微调按钮很小。据我所知,没有可以补救的属性,但是请有人告诉我我错了。或者至少,告诉我您将如何处理。也许自己从头创建微调框?

1 个答案:

答案 0 :(得分:0)

请在下面尝试。 http://jqueryui.com/spinner/

$( function() {
  var spinner = $( "#spinner" ).spinner();

  $( "#disable" ).on( "click", function() {
    if ( spinner.spinner( "option", "disabled" ) ) {
      spinner.spinner( "enable" );
    } else {
      spinner.spinner( "disable" );
    }
  });
  $( "#destroy" ).on( "click", function() {
    if ( spinner.spinner( "instance" ) ) {
      spinner.spinner( "destroy" );
    } else {
      spinner.spinner();
    }
  });
  $( "#getvalue" ).on( "click", function() {
    alert( spinner.spinner( "value" ) );
  });
  $( "#setvalue" ).on( "click", function() {
    spinner.spinner( "value", 5 );
  });

  $( "button" ).button();
} );
.ui-button.ui-widget.ui-spinner-button.ui-spinner-up {
  width: 40px;
  height: 30px;
  border: 1px solid black;
}

.ui-button.ui-widget.ui-spinner-button.ui-spinner-down {
  width: 40px;
  height: 30px;
  border: 1px solid black;
}

input {
  height: 45px;
}
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Spinner - Default functionality</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">
  <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 src="/resources/demos/external/jquery-mousewheel/jquery.mousewheel.js"></script>
</head>
 
<p>
  <label for="spinner">Select a value:</label>
  <input id="spinner" name="value">
</p>