Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the browser window scrolling loading data from the background in asynchronous form

Shulou Source: shulou.com Published: 2022-06-03 07:44:57 11月15日 Update

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)

Tags: Data background form browser browsing content code elements database method page height learning utility deeper subject interest field practicality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Docker Microsoft MySQL Shulou Technology