Mobile phone soft Keyboard pop-up impact layout of the solution _javascript tips

Source: Internet
Author: User

How to solve the layout when the soft keyboard pops up on the mobile side

1 before the mobile end of the page, because the height of only 1 pages so used height:100%;width:100%;

The layout doesn't have a big impact when you click the input box to eject the soft keyboard under iOS.

When the input box may be pressed by the soft keyboard, under a part of the android but there is a problem, Huawei's own browser and UC will have layout problems.

The reason may be because, the soft keyboard pops up, changed the height, so that height:100%, can not reach the original height.

Solution:

$ (document). Ready (function () {
$ (' body '). Height ($ (' body ') [0].clientheight);
});

After the page is loaded, JS gives the body a fixed height.

2 before also encountered, the mobile side click the input box, the page left offset part, but too long, forgot what browser, can not reproduce, the solution is to make the size of the input box centered.

PS: The new units of Huawei's own browser and UC do not recognize CSS3 under the Spit Trough, VW,VH.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.