Nguyen  Minh Binh
Nguyen Minh Binh

Reputation: 24423

Phonegap prevent scrolling when show keyboard

On Phonegap application, is there any way to prevent page scrolling when a text-input is focused and the soft keyboard shows? In case of no way, Is there any way to scroll the page to the position of text input instead of 'bring' the text input onto center of screen?

Upvotes: 3

Views: 4628

Answers (2)

TWilly
TWilly

Reputation: 4933

I've used this javascript code with some success. It overrides the window.scrollTo function and cancels it out...

window.oldScrollTo = window.scrollTo;

window.scrollTo = function (x, y) {

    console.log("window.scrollTo");
    return;
};

Upvotes: 0

Horst
Horst

Reputation: 417

in phonegap 2.6 there is a new option to prevent scrolling by resizing the webview. take a look at the documentation and find the KeyboardShrinksView option.

cheers

Upvotes: 4

Related Questions