jQuery 用于 Bootstrap 的跨浏览器数字微调器/步进器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18403657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 21:33:07  来源:igfitidea点击:

Cross-browser Numeric Spinner / Stepper for Bootstrap

jqueryhtmltwitter-bootstrap

提问by Valentin Despa

I am looking for a numeric spinner which integrates with Twitter Bootstrap 2.3, using the HTML5 input type="number"

我正在寻找一个与 Twitter Bootstrap 2.3 集成的数字微调器,使用 HTML5 input type="number"

stepper

步进器

<input type="number" id="income" name="income" value="10">

According to caniuseat the time of this writing, only Chrome renders this element as I wish. Probably Firefox will do this soon and in no more than 5 to 10 years from now, IE will also come up with a solution.

根据撰写本文时caniuse 的说法,只有 Chrome 会按照我的意愿呈现此元素。可能 Firefox 很快就会这样做,而且在 5 到 10 年后,IE 也会提出解决方案。

I've tested a couple of them, but all were 3+ years old, rely on jQuery UI and do not exactly integrate properly with Bootstrap.

我已经测试了其中的几个,但都是 3 岁以上,依赖于 jQuery UI 并且没有与 Bootstrap 完全正确集成。

Meanwhile I was just curious if there are any jQuery libraries / or other solution that render the input as in the screenshot.

同时,我很好奇是否有任何 jQuery 库/或其他解决方案来呈现屏幕截图中的输入。

采纳答案by Valentin Despa

Recently I came across the Fuel UXlibrary which also includes a spinner.

最近我遇到了Fuel UX库,它也包含一个spinner

Spinner Fuel UX

Spinner Fuel UX

回答by LeftyX

What about this bootstrap-spinedit?
It's rather old but still working as expected these days.

这个bootstrap-spinedit怎么
它相当陈旧,但这些天仍在按预期工作。

NOTE: demos do not work cause they reference non existing scripts.

注意:演示不起作用,因为它们引用了不存在的脚本。

You can see how it works here.

你可以在这里看到它是如何工作的。

HTML

HTML

<input type="text" class="aSpinEdit" />

Javascript

Javascript

$('.aSpinEdit').spinedit({
    minimum: -10,
    maximum: 50,
    step: 1
});

回答by rink.attendant.6

I'm not sure if this is one of those that you tested, but it is part of the official jQuery UI set of widgets:

我不确定这是否是您测试过的那些之一,但它是官方 jQuery UI 小部件集的一部分:

http://jqueryui.com/spinner/

http://jqueryui.com/spinner/