The mobile page input box is blocked by the keyboard.

Source: Internet
Author: User

<body class= "layout-fixed" >    <!--fixed-positioned head--    
header, footer, main{Display:Block;}Header{position:fixed;Height:50px; Left:0; Right:0;Top:0;}Footer{position:fixed;Height:34px; Left:0; Right:0;Bottom:0;}Main{Margin-top:50px;Margin-bottom:34px;Height:2000px}

This looks like the following.

The keyboard evokes the following

What is it for? : After the soft keyboard is aroused, the fixed element of the page will be invalidated (i.e. cannot be floated or understood as absolute positioning)

Solution: Move the Area field of the original body scroll to inside main

header, footer, main{Display:Block;}Header{position:fixed;Height:50px; Left:0; Right:0;Top:0;}Footer{position:fixed;Height:34px; Left:0; Right:0;Bottom:0;}Main{/*main absolute positioning, internal scrolling*/position:Absolute;Top:50px;Bottom:34px;/*so that it can be scrolled*/overflow-y:Scroll;
/*increase this property to increase the elasticity*/
-webkit-overflow-scrolling:touch;}Main. Content{ Height: 2000px;
}

h5 The bottom input box is blocked by the keyboard.
var // browser's current height      $ (window). Resize (function() {         if(document). Height () < oheight) {                 $ ( "#footer"). CSS ("position", "static");    } Else {                 $ ("#footer"). CSS ("position", "absolute");    }           });

JS to solve the problem of soft keyboard occlusion input box

Link http://blog.csdn.net/u011500781/article/details/53926425

The mobile page input box is blocked by the keyboard.

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.