简体   繁体   中英

Safari on iOS, is there any event before virtual keyboard pop up?

I'm developing a iOS browser application(html + javascript), and there's something wrong with the fixed-bottom(from twitter bootstrap) feature when virtual keyboard is pop up, so I want to disable it before virtual keyboard is pop up. Is there any event can do that ?

I've tried focus event when focusing an input field, but it's too late, the fixed bottom element will be already affect by virtual keyboard, Any solution ?

Have you tried on checking mousedown / touchstart which occurs before the focus? Just check whether the event.target.nodeName.toLowerCase() is "input" or "textarea" when it's dispatched.

I've also created https://github.com/zvona/Servant.js , which is an initial version of advanced keyboard handling. It supports "keyboardshow" but not "beforekeyboardshow". I'll check whether it can be implemented and to help in your case.

.

In Objective C you would register for one of the keyboard notifications. The one you would need is called UIKeyboardWillShowNotification. I don't know what literal string that translates to. I'd have to write a bit of code in order to figure out the string literal.

I don't know if you can register for notifications in Javascript.

Please check onresize event of body element in your html.

if you are using jquery you can use this plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM