Mobile Input Method block input box

Source: Internet
Author: User

Problem: Under Mobile Firefox browsing, the input box keyboard masks

Solution:

? Element.scrollintoview (): Let elements scroll to the viewable area
? Parameter: True the top of the object is aligned with the top of the current window
???? False the bottom of the object is aligned with the top of the current window

The code is as follows:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8" /><Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"><title>Mobile Input Method block input box</title><style>input{width:100%;Line-height:1.5rem;Border:1px solid Red;    }. Block-fill{Height:500px;   }    </style></Head><Body>    <DivID= "Main">       <DivID= "value"></Div>      <!--Placeholder Div -      <Divclass= "Block-fill"></Div>      <!--need to focus -      <inputID= "Input"type= "text"></input>    </Div></Body><Script>
Window.onload=function () {
     //Get page Heightvarclientheight=Document.body.clientHeight; varFocuselem=document.getElementById ('input'); varValueelem=document.getElementById ("value"); //Setting the monitoring focus eventDocument.body.addEventListener ("Focus", function(e) {Focuselem.scrollintoview (false); }, true);
  //Setting the Listening window change TimeWindow.addeventlistener ("Resize", function() valueelem.innerhtml="focues Resize:"+Document.body.clientHeight+"; screenheight="+clientheight; if(Focuselem&&Document.body.clientHeight<clientheight) {//use the scrollIntoView method to control the input boxFocuselem.scrollintoview (false); }  });
}
</ Script >

</ HTML >

Mobile Input Method block input box

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.