How to realize the browser window scrolling loading data from the background in asynchronous form
The main content of this article is to explain "how to load data from the background asynchronously in the browser window." interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to load data from the background asynchronously in a browser window."
The copy code is as follows:
Scroll to load database data
$(document) .ready (function () {
Var range = 50; / / length from the lower boundary / unit px
Var elemt = 500; / / insert element height / unit px
Var maxnum = 20; / / set the maximum number of loads
Var num = 1
Var totalheight = 0
Var main = $("# content"); / / body element
$(window) .subscription (function () {
Var srollPos = $(window) .scrollTop (); / / the distance from the top of the scroll bar (the height of the page beyond the window)
Totalheight = parseFloat ($(window) .height ()) + parseFloat (srollPos)
If (($(document). Height ()-range)