我想使用 javascript 计算滚动百分比。但由于 scrollHeight 问题,我无法获得。它没有考虑隐藏页面的大小。
Code: https://codepen.io/tmuthu/pen/jOmaKMQ
代替
var topsh = document.documentElement.scrollHeight || document.body.scrollHeight;
和
var topsh = document.querySelector('.main').scrollHeight
它会起作用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句