360 Browser text box to gain focus after the Android soft keyboard mask what to do _android

Source: Internet
Author: User

The scene is like this, the site filter button click after the pop-up layer (fixed), when the input box to get focus after the pop-up system with the soft keyboard, on Android 10 browser to test the comparison, found in the 360 browser pop-up keyboard after the text box to get focus is covered by a soft keyboard.

Screenshot below

(No soft keyboard focus is available)

(The situation where the Chrome browser is tuned to the soft keyboard)

(360 browser to adjust the soft keyboard condition)

So the question is, the browser's soft keyboard shows what kinds of situations? English Chinese (found on the internet)

After a simple understanding, probably analyzed the soft keyboard in the browser pop-up should include the soft keyboard occupy the main activity space, let the main activity to rearrange and not adjust the window size floating in the above two ways (haha this is my yy)

360 should be using the latter, others may be using the former.

Now that the problem arises, we must find a way to solve it. So after a simple scrutiny, basically can be concluded (there is no use of the main window of the soft keyboard technology) 1, when input to get focus, 2, soft keyboard will pop up, 3, fixed layer needs to move up, 4, successful input; 5, when input Blur or keyboard Click Return, fixed restore position (here to be thankful that 360 does not have the default to rotate the screen to follow the rotation, or else a bit of trouble)

Now that we're done, we'll write code.

1. Add Recognition Browser code

var isspecialbrowser = Navigator.userAgent.match (/360 aphone.*\ ([\d.] +) () $/i)//360 and other soft keyboard is used is the soft keyboard does not occupy the main window space caused by the suction bottom of the input to get the focus when the mask

2. Handling of events

$ (document)
 . On (' KeyDown KeyUp ', element,function (EV) {
   if (code = = && isspecialbrowser) {
     dom.css (' Bottom ',-);}}}
  . On (' Focus ', element,function () {
   if (isspecialbrowser) {
    dom.css (' Bottom ',-);
   }
  })
  . On (' Blur ', Element,function () {
   if (isspecialbrowser) {
    dom.css (' Bottom ',-);
   }
  });

Okay, the problem's solved.

But there is a problem, that is, the active click on the keyboard to put up the button is not able to get any keycode and corresponding events, so there will be a problem.

text box gets focus, loses focus calls JavaScript

The code is as follows:

 <%@ Page language= "VB" codefile= "Focus.aspx.vb" inherits= "Focus"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd 
">  
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.