Asynchronous loading technology achieves Waterfall Stream effect and asynchronous loading technology waterfall. Asynchronous loading technology achieves Waterfall Stream effect, asynchronous loading technology waterfall asynchronous loading technology achieves Waterfall Stream effect. Trigger an event when the scroll bar reaches the bottom. This event is written to the asynchronous loading technology to achieve Waterfall Stream effect, and asynchronously loaded to the technical waterfall.
Asynchronous loading technology achieves Waterfall Stream effect. Trigger an event when the scroll bar reaches the bottom. This event is written to $. the get () event transmits the Category id and page number to the internal program page. the program returns the product list of the relative pages under the category. if the program queries the current class without products, it returns null.
The scroll bar event must be written in window. onscroll to effectively judge the event. As follows:
Window. onscroll = function (){
// Var scrolltop=document.doc umentElement. scrollTop | document. body. scrollTop; var tops = $ (document ). scrollTop (); // obtain the position of the scroll bar var sctop = $ (document ). height ()-$ (window ). height (); var id = $ ("# ajax_claid "). val (); if (! Id) {id = 8 ;}$ ("# ajax_p "). val (tops); if (tops> = sctop) // if it is set up, the scroll bar is already at the bottom {var B = $ ("# ajax_p "). val (); if (B> a) {page = page + 1; // pass the page number} var Url = "aja_pro/" + id + "/" + page; // on the program page, query the returned data and directly return the information with html. $. Get (Url, function (data) {$ ("# aja_jia"). append (data );});}};
My html page is too long. how can I achieve a waterfall-like effect? Is the remaining part of content loaded when browsing to the bottom?
① Data is divided into two parts, and the rest is placed in a JSON file. if there is less data, it can be placed in js code.
② Implement a four-column layout and create several ul as the initial data display on the page.
③ Determine the distance between the last li and the browser window, and trigger the function to traverse and add the data in JSON to the page in ul format.
How can I load pages asynchronously?
To put it bluntly, there is no need for new technologies.
The jquery library has encapsulated the ajax effect and can be used directly. ajax. post. get. load
For example, a click method