![](https://camo.githubusercontent.com/565c4606d12c72c13e00dbbd52ecf72ee6765e02cd046051b2f2d58977352fbb/68747470733a2f2f646174612e6a7364656c6976722e636f6d2f76312f7061636b6167652f67682f6d6e746e2d6465762f6b62642f62616467653f7374796c653d726f756e646564)
![$.kbd](https://camo.githubusercontent.com/1bfc6ab7e76a540ca342d6036363733751c202f9afdceb075e02a19fac8a69cb/68747470733a2f2f6d6e746e2d6465762e6769746875622e696f2f6b62642f6b62642e676966)
/*
.
.
<link href="kbd.css" rel="stylesheet"/>
.
.
<script src="jquery.js"></script>
<script src="kbd.js"></script>
.
.
*/
$(function(){
$.kbd({
white:false, // keyboard theme (def.: false(=black))
qwertz:false, // layout (def.: false(=qwerty))
toggle_btn:false, // adds button to show/hide keyboard
hidden:false, // just init, don't show
input:function(char){[...]}, // input callback ($.OK/$.BS)
coffee:false // coffee splash? (white theme)
});
});
/*Methods:
--------*/
$.kbd.show()
$.kbd.hide()
$.kbd.white([true]) // white theme
$.kbd.white(false) // black
$.kbd.caps(true) // permanent caps ('longpress')
$.kbd.caps(false) // unset caps
$.kbd.caps() // toggles caps
$.kbd.alt(true) // ABC->123
$.kbd.alt(false) // 123->ABC
$.kbd.alt() // toggles ABC/123
$.kbd.lock([true]) // locks keyboard; no input
$.kbd.lock(false) // unlock
/*Vars:
-----*/
$.OK // Return/Enter
$.BS // Backspace
/*Callback example (#txt=<pre>)
-----------------------------*/
function input_cb(chr){
if(chr==$.BS/*Backspace*/)return($('#txt').text($('#txt').text().slice(0,-1)));
$('#txt').append((chr==$.OK/*Return/Enter*/)?'\n':chr);
}
/*Detect mobile device
--------------------*/
function is_md(){
return(typeof window.orientation!=='undefined')||(navigator.userAgent.indexOf('IEMobile')!==-1);
}
![$.kbd](https://camo.githubusercontent.com/193b7b55f4aea60ca39401cd055b859fad6af86c9cd8e4edeb45bd44e9ce1c87/68747470733a2f2f6d6e746e2d6465762e6769746875622e696f2f6b62642f6b62642d772e706e67)
CDN
https://cdn.jsdelivr.net/gh/mntn-dev/kbd/kbd.min.js
https://cdn.jsdelivr.net/gh/mntn-dev/kbd/kbd.css
License
MIT