Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown change the keyboard layout type #778

Open
francozzy opened this issue Apr 28, 2020 · 6 comments
Open

Dropdown change the keyboard layout type #778

francozzy opened this issue Apr 28, 2020 · 6 comments

Comments

@francozzy
Copy link

francozzy commented Apr 28, 2020

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
Copy link
Owner

Mottie commented Apr 28, 2020

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
Copy link
Owner

Mottie commented Apr 28, 2020

Ha!

I forgot I shortened it:

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

@francozzy
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

Mottie commented Apr 28, 2020

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants