$(document).height() //is to get The height of the entire page
$(window).height() // is to get the height of the current part of the page that the browser can see. This size will change when you resize the browser window, which is different from the document
To get the top, you only need to get the top when scrollTop()==0;
To get the bottom, just get scrollTop()>=$(document).height()-$(window).height() Then you will know that you have scrolled to the bottom;
$(document).scrollTop() Gets the vertical scrolling distance, which is the window where the current scroll is The distance from the top to the top of the entire page;
$(document).scrollLeft() This is the distance to get the horizontal scroll bar;
Example:
$(document).scroll(function(){
$("#lb").text ($(document).scrollTop());
})