An open API service indexing awesome lists of open source software.

https://github.com/jerray/jk-keyboard

HTML Numeric Keyboard for Mobile (4x4)
https://github.com/jerray/jk-keyboard

Last synced: about 1 year ago
JSON representation

HTML Numeric Keyboard for Mobile (4x4)

Awesome Lists containing this project

README

          

# jk-keyboard

一个为移动端页面设计的HTML数字键盘程序。

![Screenshot](https://raw.githubusercontent.com/jerray/jk-keyboard/master/screenshot/jk-1.gif)

## 用法

### 键盘布局

```html

...

```

使用`jk-left-n`和`jk-top-n`设置按键位置。可以使用`jk-height-n`来改变按键高度。

### 初始化

```javascript
(function() {
var number = document.querySelector('#number');
JK.start({
container: '#jk-keyboard',
decimal: 3,
open: true,
onKeyDown: function(value) {
console.debug('onKeyDown', value);
// prevent changing
// if (parseFloat(value) > 1000) {
// return false;
// }
},
onKeyUp: function(value) {
console.debug('onKeyUp', value);
number.textContent = value;
},
onStart: function(keyboard) {
keyboard.el.querySelector('#keyboard-down').on('click', function() {
keyboard.close();
});
number.addEventListener('click', function() {
keyboard.open();
});
}
});
})();
```

示例代码参见 `index.html`。需要使用Chrome打开该页面,然后打开开发者工具,激活手机模式。

## License

MIT