Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

安卓手机输入框被软键盘遮住的问题 #10

Open
Hancoson opened this issue Mar 7, 2017 · 0 comments
Open

安卓手机输入框被软键盘遮住的问题 #10

Hancoson opened this issue Mar 7, 2017 · 0 comments
Labels

Comments

@Hancoson
Copy link
Owner

Hancoson commented Mar 7, 2017

这个是android原生浏览器的一个bug,解决办法:

if(/Android 4\.[0-3]/.test(navigator.appVersion)){
   window.addEventListener("resize", function(){
      if(document.activeElement.tagName=="INPUT"){
         window.setTimeout(function(){
            document.activeElement.scrollIntoViewIfNeeded();
         },0);
      }
   })
}

代码参考来源:https://stackoverflow.com/questions/23757345/android-does-not-correctly-scroll-on-input-focus-if-not-body-element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant