Mottie / Keyboard

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

Positioning of keyboard based on pixels? #388

Closed bcmans closed 8 years ago

bcmans commented 9 years ago

would it be possible to do this just based on actual pixels let say 500px from the top and 200px from the left border of the screen?

I cant find how to do this other than

$('#keyboard').keyboard({

    // see http://jqueryui.com/demos/position/ for details on how to use this
    position: {
        of: $(window), // null = attach to input/textarea; use $(sel) to attach elsewhere
        my: 'center center',
        at: 'center center',
        at2: 'center center' // used when "usePreview" is false
    }

});

thanks bc

Mottie commented 9 years ago

Hi @bcbacon!

The way the jQuery UI position utility works is that you add the adjustments in with the settings (demo):

$('#keyboard').keyboard({

    // see http://jqueryui.com/demos/position/ for details on how to use this
    position: {
        of: $(window),
        my: 'left top',         // point on keyboard element
        at: 'left+200 top+500', // point in "of" element
        at2: 'center center'    // used when "usePreview" is false
    }

});

I guess I should have included that in the docs, but I figured the jQuery UI position utility docs had that covered.

But really, if you are going to always position the keyboard in the same place, you really don't need jQuery UI's position utility. You can just use css (demo):

.ui-keyboard {
  left: 200px;
  top: 500px;
}

In both demos, I set the top to 50px otherwise it makes you think the keyboard isn't positioning in the correct place... way below the input.

bcmans commented 9 years ago

thank you so much this helps big time!

Mottie commented 8 years ago

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.