我使用this fiddle进行虚拟滚动。
我无法理解如何获得真正的可滚动高度;
如果我更改行大小,则无效。
如果我做了小尺寸,比如200,它也不起作用。
var s = 20000000 // row size
var rh = 50; // row height
var th = rh * s; // virtual height
var h = 1000000; // real scrollable height
var ph = h / 100; // page height
var n = Math.ceil(th / ph); // number of pages
var vp = 400; // viewport height
var cj = (th - h) / (n - 1); // "jumpiness" coefficient
答案 0 :(得分:1)
Use $('#viewport')[0].scrollHeight
this will give you a height of the scrollbar.
Here is the JSfiddle link : Click Here
I hope this is helpful to you.