1 Star 0 Fork 30

沉淀 / A-Keyboard

forked from Bd999 / A-Keyboard 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

A-Keyboard

A-Keyboard是一个小型的 JavaScript 虚拟键盘。

访问 A-Keyboard Github Demo 网站查看在线 键盘数字键盘 Demo。

生态系统

QQ 群

欢迎加入我们的官方 QQ 群!

图片

Default:

Classic:

Dark:

GrassGreen:

Default数字键盘:

Classic数字键盘:

Dark数字键盘:

GrassGreen数字键盘:

安装

首先导入 CSS 文件:

<link rel="stylesheet" href="css/index.css">

你也可以使用 CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/akeyboard@version/css/index.css">

之后你需要导入 JS 文件:

使用 <script> 引入

<script src="index.js"></script>

CDN

<script src="https://cdn.jsdelivr.net/npm/akeyboard@version/index.js"></script>

NPM

构建大型项目推荐使用 NPM 安装:

$ npm i akeyboard

使用

如果你对使用有任何问题,请查看 test 文件夹中的 html 文件,里面有用例。

导入 JS 和 CSS 文件后你就可以通过以下方式渲染一个虚拟键盘,我们提供了 2 种虚拟键盘 普通键盘数字键盘

// 渲染普通键盘
const keyboard = new aKeyboard.keyboard({
    el: '#main', // 元素选择器名称
    style: { // 设置自定义样式
        margin: 'auto'
    },
    fixedBottomCenter: true // 将键盘自动固定到底部,并设置 width100%
})

// 渲染数字键盘
const keyboard = new aKeyboard.numberKeyboard({
    el: '#main'
})

keyboard 类提供了 2 个函数,分别为 inputOnonclick

//用来设置输入目标元素,设置之后用户点击键盘上的按键就可以输入内容了
keyboard.inputOn(目标元素选择器, 目标元素输入类型valueinnerHTMLinnerText);

//用来设置按键点击事件(会覆盖默认事件)
keyboard.onclick(按键名称, 事件函数);

模板

你可以通过修改 CSS 文件的方式创建你的专属模板,我们默认为你提供了 index,index-classic,index-dark,index-grassGreen 这几个模板:

<link rel="stylesheet" href="css/index-classic.css">
MIT License Copyright (c) 2019 A-Keyboard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A-Keyboard是一个小型的 JavaScript 虚拟键盘 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/complete_info/A-Keyboard.git
git@gitee.com:complete_info/A-Keyboard.git
complete_info
A-Keyboard
A-Keyboard
master

搜索帮助

14c37bed 8189591 565d56ea 8189591