is there a way of detecting whether a window resize event was caused by Android's popup keyboard?

℡╲_俬逩灬. 提交于 2019-12-19 04:00:56

问题


I'm writing a webpage, which will fully support mobile browsers.

The page currently uses KnockoutJS to dynamically recalculate component sizes (and hide some components) based on the screen (or container) size.

I have a problem with the android browser:

When you click on a text field, the pop up keyboard causes a screen resize, which causes KnockoutJS to (correctly) re-render the display. This momentarily causes the text field to lose focus, which pop-up keyboard to disappear.

If only I could know whether a resize was caused by the pop-up keyboard...

Thanks,

Chris.


回答1:


Solved this by adding a listener to the input's focus event which disables reacting to resize events for 0.5s.



来源:https://stackoverflow.com/questions/9149209/is-there-a-way-of-detecting-whether-a-window-resize-event-was-caused-by-android

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