I am using Cordova 3.5 and jQuery mobile to build an iOS app. I have disabled scrolling in most of the app; however, when I select an input field, the iOS keyboard opens and scrolls the page up. I do not want this functionality. Since the input is high enough that the keyboard would not cover it up, I want the page to remain still while the keyboard covers up the bottom part of the page.
This question is similar to a number of others like this one, and is the opposite of the problem posted here.
However, none of the posted answers worked for me, so I will post my solution here.
After a lot of research I found a really simple answer and none of the others worked.
In your css do:
html {
touch-action: none;
}
body {
touch-action: all;
}
From my experience, and saying this as a developer who avoids 3rd party plugins as much as possible, I've found that virtual keyboard issues in Cordova are best solved with a plugin.
The Cordova plugin directory has several keyboard
plugins
(http://cordova.apache.org/plugins/?q=keyboard)
I recommend the following plugin:
https://github.com/cjpearson/cordova-plugin-keyboard
Which provides the following command to disable scrolling when the virtual keyboard is open.
cordova.plugins.Keyboard.disableScrollingInShrinkView(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With