For example,
function fnCheckScroll(){
var iNewHeight = oDiv.scrollHeight;
var iscrolTop = oDiv.scrollTop;
alert(\"The value of the scrollHei
See the MDC articles, scrollTop and scrollHeight. In summary, scrollTop is how much it's currently scrolled, and scrollHeight is the total height, including content scrolled out of view.
If I scroll down 5px in this window, the window's scrollTop
value is 5. If I scroll right 10px in a scrollable div, the div's scrollLeft
value is 10.
When I scroll to the top left corner of this window, both its scrollTop
and scrollLeft
values are 0.
In Safari 6.0.1 the scrollHeight gives the height of the control and not the total height including content scrolled out of view. So it cannot be used to find the total height required to show without a scroll bar.
Please see the following picture:
Ref: scrollTop, scrollHeight, clientHeight