This article mainly introduces jquery's method of determining that the scroll bar has reached the bottom and reached the top. For more information, see
The Code is as follows:
$ (Document). height () // gets the height of the entire page
$ (Window). height () // gets the height of the page that the browser can see. This size will change when you zoom in the browser window, which is different from the document size.
To get the top, you only need to get scrollTop () = 0, which is the top;
To get the bottom end, you only need to get scrollTop () >=$ (document). height ()-$ (window). height () to know the end of the scroll;
The Code is as follows:
$ (Document). scrollTop () gets the vertical scroll distance, that is, the distance from the top of the current tumble window to the top of the entire page;
$ (Document). scrollLeft () This is the distance to obtain the horizontal scroll bar;
Example:
The Code is as follows:
$ (Document). scroll (function (){
$ ("# Lb"). text ($ (document). scrollTop ());
})