东莞网络开发,seo最新,海珠区 网站设计,鲜花网网站开发的意义如何在触摸设备上为输入域添加虚拟键盘#xff1f;
一个插件可以解决这个问题#xff0c;关键还支持高度自定义#xff08;git地址#xff09;#xff1a;
GitHub - Mottie/Keyboard: Virtual Keyboard using jQuery ~
官网地址#xff1a;Virtual Keyboard 使用步骤
一个插件可以解决这个问题关键还支持高度自定义git地址
GitHub - Mottie/Keyboard: Virtual Keyboard using jQuery ~
官网地址Virtual Keyboard 使用步骤
1. 下载相关资源
文件夹如下所示
2. 修改例子
我的需求相对简单就是需要一个输入纯数字的键盘那么我将基于basic文件进行修改。
代码示例如下
!DOCTYPE html
html
headmeta charsetutf-8title虚拟键盘/title!-- 引入jquery --script srcjs/jquery-latest.min.js/script!-- 引入自定义样式 --link href../css/keyboard1.css relstylesheet!-- 引入键盘 --script src../js/jquery.keyboard.js/scriptscript$(function(){$(#keyboard).keyboard({layout: custom, // 自定义布局usePreview: false, customLayout: {normal : [7 8 9,4 5 6,1 2 3,0 {bksp}]},autoAccept: true, // 自动输入到input中language: zh, // 中文display: {bksp: 删除 // 需要把对应的按钮设置为中文},});});/script
/head
bodydiv idwrap input idkeyboard typetext/div/body
/html样式可以自定义这里不再附上。
具体显示为 同时支持高度自定义键盘只需要在 customLayout 定义即可
比如
customLayout: {default : [{rad} {deg} {grad} {sp:.1} {MC} {MR} {MS} {MPLUS} {M-} {a},{meta1} {ln} ( ) {b} {clear} {clearall} {sign} {sqrt} {c},{sinh} {sin} {x2} {n!} 7 8 9 / %,{cosh} {cos} {xy} {yroot} 4 5 6 * {invx},{tanh} {tan} {x3} {cuberoot} 1 2 3 - {equals},{pi} {Int} {mod} {log} {10x} 0 {dec} ],meta1 : [{rad} {deg} {grad} {sp:.1} {MC} {MR} {MS} {MPLUS} {M-} {a},{meta1} {ex} ( ) {b} {clear} {clearall} {sign} {sqrt} {c},{asinh} {asin} {x2} {n!} 7 8 9 / %,{acosh} {acos} {xy} {yroot} 4 5 6 * {invx},{atanh} {atan} {x3} {cuberoot} 1 2 3 - {equals},{2pi} {Int} {mod} {log} {10x} 0 {dec} ]},
更多案例可查看docs文件夹。