在移动端中,部分安卓手机遇到输入框被软键盘遮挡问题。

 

解决方法:

           //如果是安卓手机,添加获得焦点的滚动事件

            if (/Android/gi.test(navigator.userAgent)){

                window.addEventListener('resize', function() {

                    if (document.activeElement.tagName == 'INPUT'|| document.activeElement.tagName == 'TEXTAREA') {

                        window.setTimeout(function() {

                            document.activeElement.scrollIntoViewIfNeeded();

                        }, 0);

                    }

                });

            }

相关文章:

  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案