当移动safari或chrome上的屏幕键盘打开时,是否有任何javascript事件被触发? [英] Is there any javascript event fired when the on-screen keyboard on mobile safari or chrome opens?
问题描述
我尝试对Web应用程序中的屏幕键盘做出反应。不幸的是,有些事情使这一点变得复杂:
I try to react to the on-screen keyboard in our web applications. Unfortunately there are some things complicating this:
首先,应用程序必须在移动平台(平板电脑)和台式机上运行。此外,禁止滚动文档/正文并增加更多功能,平板电脑必须使用横向模式。
First of all, the application has to run equally on mobile platforms (tablets) and desktops. Additionally scrolling the document/body is forbidden and to spice things up even more, landscape mode is mandatory on tablets.
因此,如果有人选择任何输入字段,则 - 屏幕键盘打开并阻挡页面一半的视线,因此一些输入变得不可见,我需要更改它。
So, if someone selects any input field, the on-screen keyboard opens up and blocks the sight on half of the page, therefor some inputs become invisible and I need to change that.
不幸的是,似乎没有事件被触发完全,这表明,一半的应用程序刚刚变得不可见。我已经检查了滚动和重新调整事件的大小,但它们也没有触发。
Unfortunately it seems, there is no event fired at all, which indicates, that half of the application just became invisible. I already checked scroll and resize events, but they didn't fire, too.
当然,我总是可以在我确定要开始时以某种方式作出反应平板电脑。可能95%的用户无论如何都不会连接硬件键盘。但是,有没有更清洁的方式?
Of course, I could always react somehow as soon as I'm sure to be on a tablet. Probably 95% of the users will not attach a hardware keyboard anyway. But isn't there any cleaner way?
推荐答案
不幸的是,这里的答案很明确:否 。这里有一些相关的问题和一些进一步的信息和技巧:
Unfortunately the answer here is a clear: NO. There are some related questions here with some further information and tricks:
iPad Web App:在Safari中使用JavaScript检测虚拟键盘?
Android / iPhone webkit,键盘弹出触发事件?
这篇关于当移动safari或chrome上的屏幕键盘打开时,是否有任何javascript事件被触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!