On the phone, click on the input box soft keyboard appears when the input box is not overwritten, displayed in the middle of the screen

Source: Internet
Author: User

1
Solve with the problem of positioning
var oheight = $ (document). Height (); Browser's current height

$ (window). Resize (function () {

if ($ (document). Height () < oheight) {

$ ("#footer"). CSS ("position", "static");
}else{

$ ("#footer"). CSS ("position", "absolute");
}

});

2 The second method is to change the height of the area.
var loaclheight = $ ("section"). Height ();//Get visual width
$ ("Input,textarea"). focus (function () {
var keyboardheight = localheight-$ ("section"). Height ();//Gets the height of the keyboard
var keyboardy = localheight-keyboardheight;
var addbottom = (parseint (this). Position (). Top) + parseint ($ (this). Height ()));//Bottom of text field
var offset = addbottom-keyboardy;//Calculates the distance of the upper slide
$ ("section"). scrolltop (offset);
});

On the phone, click on the input box soft keyboard appears when the input box is not overwritten, displayed in the middle of the screen

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.