html5 - Re-sizing viewport height when the iOS7 soft keyboard is opened in Trigger.io -


When the soft keyboard is opened in Android, the viewport is automatically shaped to fit the screen ( Height of device - keyboard height). The viewport is pushed just in iOS7 (the top half is not displayed just)

However this may be the desired behavior for some apps, but it does not work well for me - the top ENV bar is hidden, and my content is a scrollable div - I want to The user is able to scroll all the way

The keyboard opens / closes when resizing the body manual

Any idea how to solve it?

I had the same requirement This solution was a mixture of body height to reduce when the keyboard was shown And to determine the transfer of the content area. In this way the code will look like using jQuery:

  $ (document) .on ("focus", "input, textarea", function () {$ ('html'). AddClass ("keyboard"); settimeout (function () {window.scrollTo (0,0); doc. Body.scrollTop = 0;}, 0);}); $ (Document) .on ("blur", "input, taxacea", function () {$ ('html'). RemoveClass ("keyboard");});  

and related CSS:

  body {position: absolute; Top: 0; Bottom: 0; } .keyboard body {bottom: 240px; / * For example, value * /}  

Need to adjust the bottom value to match the right keyboard height on iPhone Portrait, iPhone Landscape, iPad Portrait and iPad Landscape.

I have not tested this code in a while, so you can check whether it works without any playfulness for you or not? If I remember correctly, I had a slight flicker in Mobile Safari, but it works fine within the original webvive.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -