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

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

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

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

soyeoneone opened this issue Feb 28, 2013 · 2 comments

Comments

@soyeoneone
Copy link

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?

@Mottie
Copy link
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);
            });
        }
    }

})

@Mottie
Copy link
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 as completed May 6, 2013
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