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

Already on GitHub? Sign in to your account

how to change between virtual keyboard and real keyboard? #144

Closed
soyeoneone opened this Issue Feb 28, 2013 · 2 comments

Comments

Projects
None yet
2 participants

When used "lockInput: true" , I can only input throw virtual keyboard. Is there a button or such a similar method that can change to real keyboard?

Owner

Mottie commented Feb 28, 2013

Hi soyeoneone!

There isn't anything built into the keyboard to do that, but you can include the code below to add a lock/unlock button (demo):

$('#keyboard').keyboard({
    // Prevents direct input in the preview window when true
    lockInput: true,

    visible: function (e, kb, el) {
        if (!kb.$keyboard.find('.ui-keyboard-lock').length) {
            kb.$keyboard.append('<button class="ui-keyboard-button ui-keyboard-lock ui-state-default ui-corner-all"><span class="ui-icon-locked ui-icon"></span></button>');
            kb.$keyboard.find('.ui-keyboard-lock').click(function(){
                var locked = !kb.options.lockInput;
                kb.options.lockInput = locked;
                kb.$preview
                    .toggleClass('ui-keyboard-lockedinput', locked)
                    .prop('readonly', locked);
                $(this).find('span')
                    .toggleClass('ui-icon-locked', locked)
                    .toggleClass('ui-icon-unlocked', !locked);
            });
        }
    }

})
Owner

Mottie commented May 6, 2013

I'm guessing this issue has been resolved, so I'm closing it.

I did have to update the above demo & code - I changed:

if (!kb.$keyboard.find('.unlock').length) {

to

if (!kb.$keyboard.find('.ui-keyboard-lock').length) {

I also added it to the list of more demos.

@Mottie Mottie closed this May 6, 2013

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