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
Cross-browser Numeric Spinner / Stepper for 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"
<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
回答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 小部件集的一部分: