问题:由于内容区域太高,触发了滑块的最小值就会出现问题,滑块拖动到最后,但是内容不是最后!
代码:
`
const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height
`
这里计算比例 如果触发最小值 就会减少块实际可滑动距离,造成问题。
建议修改为:可滑动距离/内容区域高度-可视区域高度
const scrollRatioY = this.scrollRatioY = (scrollYBounds.height - (Math.max(scrollYBounds.height * ratioY, minSize))) / (contentBounds.height - viewportBounds.height)
问题:由于内容区域太高,触发了滑块的最小值就会出现问题,滑块拖动到最后,但是内容不是最后!
代码:
`
const scrollRatioY = this.scrollRatioY = scrollYBounds.height / contentBounds.height
`
这里计算比例 如果触发最小值 就会减少块实际可滑动距离,造成问题。
建议修改为:可滑动距离/内容区域高度-可视区域高度
const scrollRatioY = this.scrollRatioY = (scrollYBounds.height - (Math.max(scrollYBounds.height * ratioY, minSize))) / (contentBounds.height - viewportBounds.height)