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

微信浏览器H5页面软键盘关闭导致页面空缺的问题 #2

Open
cklwblove opened this issue Jan 11, 2019 · 0 comments
Open
Labels

Comments

@cklwblove
Copy link
Owner

cklwblove commented Jan 11, 2019

问题场景

  • 微信 H5 页面里的 select, input, textarea 等输入框软键盘弹起的时候页面会上移,软键盘关闭页面不会下移,导致页面空缺了一部分
  • 微信打开网页键盘弹起后页面上滑,导致弹框里的按钮输入框等响应区域错位

解决方案

$('textarea').on('blur',function(){
  setTimeout(function(){
    // 滚动到顶部
    window.scrollTo(0, 0);
    // 滚动到底部
    // window.scrollTo(0, document.documentElement.clientHeight);
  },100)
})

重点是:添加 blur 事件 window.scrollTo(0, 0)


相关链接

  1. 微信打开网页键盘弹起后页面上滑,导致弹框里的按钮响应区域错位
@cklwblove cklwblove added the 👍置顶 置顶 label Apr 19, 2020
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