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
$ (Document ). height () // obtain the height of the entire page $ (window ). height () // obtain 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;
$ (Document ). scrollTop () gets the vertical scroll distance, that is, the distance from the top of the window to the top of the page where the current scroll is located; $ (document ). scrollLeft () is the distance to obtain the horizontal scroll bar;
Example:
$ (Document). scroll (function () {$ ("# lb"). text ($ (document). scrollTop ());})
For more information about how jquery determines that the scroll bar has reached the bottom and top of the page, see PHP!