I am trying to calculate the diistance from the bottom the the window to the current scroll position. I have used the following code ( LIVE DEMO ) :-
$(window).scroll(function(){
var height= $(document).height() - $(document).scrollTop();
$(".height").html(height);
});
The ouput when I scroll to the bottom must be 0. But, the output is something greater than 400. Please tell me how to fix it. Thanks in advance. Any help will be appreciated.