We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
问题描述: ios手机,点击输入框调起键盘后,整个页面被顶上去了,关闭弹窗后页面还是没有下来,导致下面有一大块空白,但是手动滚动一下就好了,怎么办?
首先,我尝试监听了键盘的blur事件,在键盘blur后去调用一下滚动,代码如下: window.scrollTo(0, document.documentElement.scrollTop || document.body.scrollTop )
window.scrollTo(0, document.documentElement.scrollTop || document.body.scrollTop )
结果发现: 有时候生效有时候不生效
于是对该方法做了改进:加了延时并且少滚动一像素,发现成功解决了这个问题,完美
setTimeout(() => { const scrollH = document.documentElement.scrollTop || document.body.scrollTop window.scrollTo(0, Math.max(scrollH - 1, 0) ) }, 100)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题描述:
ios手机,点击输入框调起键盘后,整个页面被顶上去了,关闭弹窗后页面还是没有下来,导致下面有一大块空白,但是手动滚动一下就好了,怎么办?
首先,我尝试监听了键盘的blur事件,在键盘blur后去调用一下滚动,代码如下:
window.scrollTo(0, document.documentElement.scrollTop || document.body.scrollTop )
结果发现:
有时候生效有时候不生效
于是对该方法做了改进:加了延时并且少滚动一像素,发现成功解决了这个问题,完美
The text was updated successfully, but these errors were encountered: