After the mobile input box gets the focus, the virtual keyboard pops up and pushes up the fixed bottom. How to solve the problem?

as shown in the picture, how to solve the problem perfectly

Mar.03,2021

Virtual keyboard pops up to hide the bottom, otherwise, you can focus on the (onfocus), out-of-focus (onblur) event by monitoring the input box


this is the mobile layout pit. Wrap up your content and add
.main {

  position: fixed;
  top: 0px;
  bottom: 50px;
  overflow-y: scroll;

}


    /**/
    let winHeight = window.innerHeight
    window.addEventListener('resize', function() {
      if (winHeight > window.innerHeight) {
        /**/
        document.getElementsByTagName('body')[0].setAttribute('height', winHeight+'px')
      }else {
        /**/
        document.getElementsByTagName('body')[0].setAttribute('height', '100%')
      }
    })

give it a try.

  • Conversion between px and rem on Mobile

    when I was reading the article today, I saw a piece of code that I didn t quite understand, so I would like to ask for advice here. article address: https: www.cnblogs.com azhai. Code snippets that you don t understand: docEl.style.fontSize = 20...

    Mar.25,2021
  • Mobile special effects problem

    https: www.apple.com cn ios . the problem of sliding special effects viewed on Apple s official website on the mobile side. in F12, I found that the z-index attribute of each < session > tag is arranged from big to small, but there is no train of ...

Menu