I assume that your DIV is a long list of text lines, and all your lines will be of uniform height. If this is true, then you don t need to ask which one is at the top of the viewport, as you will be able to calculate it.
You ll want to be displaying the first page of this stuff in full anyway, so you create one complete and displayable line, ask it for its height and remember that. Then you add some more text-containing lines until the total height of them is greater than the height of the window. Then, add 1990 or so empty lines so that the thumb s size and position accurately reflect the size of the list.
Then, when someone scrolls your window, you can calculate which lines should be visible; zap those that have moved out of view and build up the ones that should be visible. Done!
(I think - I ve never tried this!)