Using PGB can my Javascript application know when the keyboard has opened?
I have a page that has a textbox a little bit below the pages vertical middle. When the user sets focus into that textbox, the keyboard opens and covers all but the topmost 2 or 3 pixels of the textbox.
If I could know when the keyboard opened and what element has the focus I could probably scroll them some more manually...
I am not sure about phonegap, but I had a similar problem in a webapp for Android.
When the virtual keyboard is opened (on Android devices), the window.onresize
event is called. You can store the original height of the viewport when the app is starting, so you know later on if the virtual keyboard is opened or closed (based on the current height of the viewport).
Anyway, as you have the problem on an input element, you could also use the onfocus
and onblur
events for it.