ios system bug about position:absolute

The above two pictures illustrate the bugs encountered
          

When selecting the unit name, a selection box pops up at the bottom, and the page pops up. The page does not come back after the selection is completed. It is the same problem when the keyboard is closed after the input box pops up.

My 6sp did not have this problem, my colleague’s 6s appeared, and other models of mobile phones have not been tested.

After investigation, the Window window rolled up when the keyboard popped up, and the window did not return to normal when the keyboard was closed.

Solution:

// 当body元素或其任意子元素失去焦点时,设置 window窗口 滚动值为0
$("body").focusout(function(){
    $(window).scrollTop(0);
});

You can judge whether the keyboard is retracted by whether the focus is lost.

Attach a link: the usage of focusout

If there are other easy ways, welcome to communicate. (*^▽^*)

 

 

Guess you like

Origin blog.csdn.net/qq_37514029/article/details/85066990