I make virtual scrolling by using this fiddle.
I can not understand how to get the real scrollable height;
If I change row size, it doesn't work.
And the if I made small size, such as 200, it doesn't work,too.
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
Use $('#viewport')[0].scrollHeight
this will give you a height of the scrollbar.
Here is the JSfiddle link : Click Here