Preventing iOS Keyboard from scrolling page in cordova 3.5
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);
Add this plugin with
cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard.git
in the command line.
Add the following line anywhere it the javascript to disable scrolling from the keyboard.
cordova.plugins.Keyboard.disableScroll(true);
In my use case, I added a deviceready
event listener to evaluate this line, disabling the automatic keyboard scrolling everywhere in the app.
That's it!
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;
}