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
亲测部分android机型拖动多次会拖动不了,因为 ele.scrollHeight - ele.scrollTop === ele.clientHeight + 1,所以一直判断不为edge,上拉刷新不了,所以isEdge方法可以加一行代码兼容一下。 机型为:oppo A57
修改isEdge函数 isEdge(ele, direction) { const container = this.props.getScrollContainer(); // 父容器需要设置height100vh,scroll auto时,scrollTop才会改变,不然一直为0 if (container && container === document.body) { // In chrome61 document.body.scrollTop is invalid const scrollNode = document.scrollingElement ? document.scrollingElement : document.body; if (direction === UP) { return scrollNode.scrollHeight - scrollNode.scrollTop <= window.innerHeight; } if (direction === DOWN) { return scrollNode.scrollTop <= 0; } } if (direction === UP) { // 兼容部分android机型,需要 + 1px return ele.scrollHeight - ele.scrollTop === ele.clientHeight + 1 || ele.scrollHeight - ele.scrollTop === ele.clientHeight; } if (direction === DOWN) { return ele.scrollTop <= 0; } }
document.body.scrollTop
The text was updated successfully, but these errors were encountered:
亲测部分android机型拖动多次会拖动不了,因为 ele.scrollHeight - ele.scrollTop === ele.clientHeight + 1,所以一直判断不为edge,上拉刷新不了,所以isEdge方法可以加一行代码兼容一下。 机型为:oppo A57 修改isEdge函数 isEdge(ele, direction) { const container = this.props.getScrollContainer(); // 父容器需要设置height100vh,scroll auto时,scrollTop才会改变,不然一直为0 if (container && container === document.body) { // In chrome61 document.body.scrollTop is invalid const scrollNode = document.scrollingElement ? document.scrollingElement : document.body; if (direction === UP) { return scrollNode.scrollHeight - scrollNode.scrollTop <= window.innerHeight; } if (direction === DOWN) { return scrollNode.scrollTop <= 0; } } if (direction === UP) { // 兼容部分android机型,需要 + 1px return ele.scrollHeight - ele.scrollTop === ele.clientHeight + 1 || ele.scrollHeight - ele.scrollTop === ele.clientHeight; } if (direction === DOWN) { return ele.scrollTop <= 0; } }
设置误差范围靠谱点,这玩意有时候返回的是小数,Math.abs(ele.scrollHeight - ele.scrollTop - ele.clientHeight)<=1
Sorry, something went wrong.
No branches or pull requests
亲测部分android机型拖动多次会拖动不了,因为 ele.scrollHeight - ele.scrollTop === ele.clientHeight + 1,所以一直判断不为edge,上拉刷新不了,所以isEdge方法可以加一行代码兼容一下。
机型为:oppo A57
The text was updated successfully, but these errors were encountered: