Mottie / Keyboard

Virtual Keyboard using jQuery ~
http://mottie.github.io/Keyboard/
Other
1.77k stars 722 forks source link

Dropdown change the keyboard layout type #778

Open francozzy opened 4 years ago

francozzy commented 4 years ago

Hi,

I want to make keyboard always visible, but will be change when dropdown value get change follow by the keyboard view type, for example from Numeric Pad into AlphaNumeric Pad. So please help me to solve this issue

image thank u

Mottie commented 4 years ago

Hi @francozzy!

Try the redraw method - demo

$(function() {
  var $kb = $("#keyboard");

  $kb.keyboard({
    layout: "qwerty",
    // if true, the keyboard will always be visible
    alwaysOpen: true
  });

  $("select").change(function(event) {
    var val = event.target.value;
    var kb = $kb.getkeyboard();
    kb.options.layout = val;
    kb.redraw();
  });
});
Mottie commented 4 years ago

Ha!

I forgot I shortened it:

$("select").change(function(event) {
  var val = event.target.value;
  $kb.getkeyboard().redraw(val);
});
francozzy commented 4 years ago

hi, thanks for your response is it possible if i built select options and for all options reference to different custom keyboard layout for this example using custom Num and custom Alphanum So how to solve it if that's possible

thank u

francozzy commented 4 years ago

ha,

i got solution for my issues i will make two custom layout to initialize before declare the keyboard same as your example here at https://github.com/Mottie/Keyboard/wiki/Layout (Remap Section) but if u have more simple solution, i would like to try

btw thank u again

Mottie commented 4 years ago

is it possible if i built select options and for all options reference to different custom keyboard layout

Add as many as you want.

But be aware that you can only create one custom layout. In that case, you would need to add your named layouts into the jQuery.keyboard.layouts, then use those same names in the select value.

francozzy commented 4 years ago

Add as many as you want.

But be aware that you can only create one custom layout. In that case, you would need to add your named layouts into the jQuery.keyboard.layouts, then use those same names in the select value.

ok. i'll keep it.

thanks again