Text field get hidden behind softkeyboard in Phonegap on iPhone4S

醉酒当歌 提交于 2019-12-10 09:46:25

问题


I was making a Phonegap App in which there is a input field inside a iscoll4 container. The gray background is of iscroll and a text field is a "Enter ID". The Screen Shot is before

When I click on the Text Box the keyboard Pops Up that is working fine but the text field is behind the keyboard and the user cant see the text field properly. The Screen Shot is before.

And as soon as I start typing the text box scrolls up.

My problem is that the text box should scroll up as soon as I click on text field and the keyboard is shown.

I am using Phonegap 2.2 and iscroll4. I am working on iPhone with iOS 5.1 and iOS 6.0.

I have already tried using following things

  1. iScroll.scrollToElement('#ID'); - It is scrolling up but immediately it get back to the previous position
  2. create a keyboard event using jQuery ( jQuery.event.trigger({ type : 'keypress', which : character.charCodeAt(32) });) - it dont work on iPhone.

来源:https://stackoverflow.com/questions/14050984/text-field-get-hidden-behind-softkeyboard-in-phonegap-on-iphone4s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!