android-> button at the bottom is positioned on the shift

EDITORIAL: Previous yourself, you can concentrate on doing things their own now, like ants on a hot pan learning every investment boiling. Changes state, starting from a small blog.

Speaking in front of a pit ios met, met again this week, Andrews own pit 

Solutions on native and vue

1. Andrews pit of soft keyboard bounce is not your background, oh ~

 Achieve a form of function, as shown below,

The white box is a form to fill the entire inside, no matter how much is the mobile phone screen, the white box must give me a distraction // parent box

List-form-.bank {   
    min-height : 100% ; 
    height : 100% ; 
    width : 750 / @ REM ; 
    background : URL ( "xxx.png") ; 
    background-size : 750 / @ REM Cover ; // sub box 
    .bank-warpper { 
        width : 690 / @ REM ; 
        min-height : 100% ; // parent height of the box and stay consistent over the entire screen   } 
}  



 

Pit 1: Background entire page is a picture, when the soft keyboard bounce, background will be compressed and deformed, renderings do not show the change in this way, to set a background image of the background height

       Tips 1: For such a large picture as a background, be sure to phone the following no-repeat otherwise there will be a large part of the display screen of white border

background-size: 750/@rem cover;  

cover covering the entire width of the page as long as the height is provided to prevent the page height changes, the two opened
Pit 2: Page button absolute positioning in the end, a soft keyboard buttons to follow up leads bounced 
normal wording:
    .bank-wrapper {
        width: 690/@rem;  
        min-height: 100%;
        position: relative;

        .bottom-fixed{
            position: absolute;
            bottom: 40/@rem;  
            width: 630/@rem; 
        }
}

 The relative positioning of the parent element, since the absolute positioning of elements on it, but in Andrews, you will find soft keyboard bounce, button will go up, leading to confusion page style, will happen in the browser, a small screen ,

Cause analysis: Since the height of the white input frame portion inside the page is dependent on the overall height, while the overall height of 100%, resulting height of the interior also was 100%, the height is not enough, the bottom of the relative positioning of the button naturally and will be positioned to a position overlapping input box form.

 

 First solve the problem of overlapping: buttons are always in the form of part of the input box, set the white form of the lower part of the frame height padding-bottom> button, so the height is natural enough, the phone's small screen, the button does not immediately apply It overwrites the form box.

Continue connected to the problem, the button will not overlap, but the soft keyboard bounce, height of the entire page will be smaller, but will lead to deformation of the page,

  var windheight = $ (window) .height (); // get the page height before deformation 
      $ (window) .resize (function () { 
        var docheight = $ (window) .height (); 
        IF (docheight <windheight) {   
            $ ( "body") css ( " height", windheight);. // when the soft keyboard bounce when the height of the page is automatically set to the original height, so that enough 
        } the else {    
            $ ( "body") CSS (. " height "," 100% ") ; // soft keyboard to fall back to the original height 
        }            
      });

  In the whole problem solving, attention to two points: Picture button located at the bottom of the background.

 

How to solve 2.vue

 .commpn-apply {
    background: url("xxx") no-repeat;
    background-size: 100% 482px;
    padding-left: 30px;
    padding-right: 30px;
    height: 100vh; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
.son{
height:100%
   }    
}

 

 Solution: media query method, the page changes to the height of the box

  @media (min-width: 320px) {
    .commpn-apply {
      min-height: 568px;
      height: 100vh;
    }
  }

  @media (min-width: 375px) {
    .commpn-apply {
      min-height: 667px;
      height: 100vh;
    }
  }

  

 



 

Guess you like

Origin www.cnblogs.com/mfyngu/p/11708307.html
Recommended