search

Home  >  Q&A  >  body text

javascript - iphone safari browser input focus problem

I limited the height of the web page to 100%, and absolutely positioned an input box at the bottom,

In Safari on iOS, when you click on the input box, the virtual keyboard can pop up and push the entire page up, but at least the input box is above the keyboard and can be seen.

But if the keyboard pops up through the focus of js, the keyboard will directly cover up part of the content at the bottom of the page, and the input box will be invisible. Why is focusing different from directly clicking on the input box? How to solve it? Does anyone know?

PHPzPHPz2768 days ago735

reply all(1)I'll reply

  • 阿神

    阿神2017-05-19 10:33:43

        setTimeout(function() {
            document.body.scrollTop = document.body.scrollHeight;
        }, 300);

    reply
    0
  • Cancelreply