jQuery mobile - iOS - 如何检测键盘何时打开?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8606889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 10:44:53  来源:igfitidea点击:

jQuery mobile - iOS - How to detect when the keyboard is opening?

jqueryioseventsjquery-mobilekeyboard

提问by frequent

I'm working on a jQuery mobile site and need to update my layout when the iOS keyboard is showing up or hiding.

我在一个 jQuery 移动网站上工作,需要在 iOS 键盘显示或隐藏时更新我的​​布局。

Is there some event I can bind to? Doesn't necessarily have to be a JQM event, any other would also suffice.

有什么我可以绑定的事件吗?不一定必须是 JQM 事件,任何其他事件也足够了。

Thanks for help!

感谢帮助!

回答by Matt K

See this thread.Scanning through the answers, I believe you can determine if the keyboard is open by detecting the focus on form input elements.

看到这个线程。浏览答案,我相信您可以通过检测表单输入元素的焦点来确定键盘是否打开。