Javascript 基于 JS 的浏览器屏幕键盘,如手机和平板电脑
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8762431/
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
JS Based on-screen keyboard for browser, like on cellphones and tablets
提问by Sherzod
We have an app for an embedded system, and we are developing several apps based on HTML5, CSS3, and some JS libraries, which run on a webkit browser. I was wondering if there are any libraries that implemented on screen keyboard with customizable graphics of keys. It should also be easy to internationalize it.
我们有一个嵌入式系统的应用程序,我们正在开发一些基于 HTML5、CSS3 和一些 JS 库的应用程序,它们在 webkit 浏览器上运行。我想知道是否有任何库在屏幕键盘上实现了可自定义的按键图形。它也应该很容易国际化。
May be anything based on HTML5 canvas?
可能是基于 HTML5 画布的任何东西吗?
I appreciate any input. Thanks!
我感谢任何输入。谢谢!
采纳答案by Gregg B
Something like this?
像这样的东西?
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/
Additionally, here is a (different) plugin instead of a tutorial:
此外,这是一个(不同的)插件而不是教程:
回答by czerasz
You could try the Virtual Keyboardwhich has a lot of features, language layoutsand is very well documented.
You can also easily integrate it with bootstrap:
您可以尝试虚拟键盘,它具有很多功能、语言布局并且有很好的文档记录。
您还可以轻松地将其与引导程序集成:
$('#keyboard').keyboard({
layout: 'qwerty',
css: {
// input & preview
input: 'form-control input-sm',
// keyboard container
container: 'center-block dropdown-menu', // jumbotron
// default state
buttonDefault: 'btn btn-default',
// hovered button
buttonHover: 'btn-primary',
// Action keys (e.g. Accept, Cancel, Tab, etc);
// this replaces "actionClass" option
buttonAction: 'active',
// used when disabling the decimal button {dec}
// when a decimal exists in the input area
buttonDisabled: 'disabled'
}
})
Find the full example here.
在这里找到完整的例子。
You could also try the On Screen Keyboardwhich is a lot simpler and less feature rich.
您也可以尝试屏幕键盘,它更简单,功能也更少。
回答by Francisco Hodge
I recommend simple-keyboard. Especially to those looking for a lightweight javascript virtual keyboard without any dependency (jQuery or otherwise) or are interested in a flexbox layout.
我推荐simple-keyboard。特别是对于那些正在寻找没有任何依赖(jQuery 或其他)的轻量级 javascript 虚拟键盘或对 flexbox 布局感兴趣的人。
You can find the demo here: View Demo
您可以在此处找到演示:查看演示
Disclosure: I'm the author of the package. Feel free to message here or on Github with any questions or issues you have.
披露:我是包的作者。如有任何疑问或问题,请随时在此处或 Github 上留言。