The scene is this, the site filter button click after the popup layer (fixed), when the input box to get the focus after the system comes out of the soft keyboard, on Android 10 browser to test the comparison, found in 360 browser pop-up keyboard after the focus of the text box was covered by the soft keyboard. As follows
(case where soft keyboard focus is not acquired) (Chrome browser is adjusting the soft keyboard) (360 browser to adjust the soft keyboard)
So the question is, what kind of situation does the browser's soft keyboard show? English Chinese (online search)
After a simple understanding, probably analyzed the soft keyboard pop-up on the browser should include a soft keyboard to occupy the main activity space, so that the main activity re-layout and not adjust the size of the window floating in the above two ways (haha this is my yy)
360 should be using the latter, others may be using the former.
Since the problem arises, it is necessary to find a way to solve, so after a simple scrutiny, basically can be obtained ( there is no space to occupy the main window of the soft keyboard technology ) 1, when input to get the focus, 2, the soft keyboard will pop up, 3, the fixed layer needs to move up, 4, the successful input ; 5, when input blur or keyboard hit enter, fixed restore position (here to be thankful that 360 does not have the default with rotation screen following the rotation, or else a little trouble)
Now that the analysis is complete, write the code.
1. Add Recognition Browser code
1 |
var isSpecialBrowser = navigator.userAgent.match(/360 Aphone.*\(([\d.]+)\)$/i) //360等部分软键盘采用的是软键盘不占用主窗口空间造成,吸底的 input获取焦点的时候被遮罩 |
2. Handling Events
123456789101112131415161718 |
$(document)
.on(
‘keydown keyup‘
, Element,
function
(ev) {
if
(code == 13 && isSpecialBrowser) {
DOM.css(
‘bottom‘
, -310);
}
}
})
.on(
‘focus‘
, Element,
function
() {
if
(isSpecialBrowser) {
DOM.css(
‘bottom‘
, -110);
}
})
.on(
‘blur‘
, Element,
function
() {
if
(isSpecialBrowser) {
DOM.css(
‘bottom‘
, -310);
}
});
|
Okay, the problem is solved.
But the problem is that the active click on the keyboard to close the button is not able to get any keycode and corresponding events, so there will be a problem.
360 the problem that a browser text box is masked by a soft keyboard after getting focus