Home > Article > Backend Development > ThinkPHP implements waterfall flow method, thinkphp implements waterfall_PHP tutorial
The example in this article describes how thinkPHP implements waterfall flow. Share it with everyone for your reference. The specific analysis is as follows:
Many people want to make the effect of waterfall flow. Here I will tell you how to use the official website. First, download the waterfall flow plug-in jquery.masonry.min.js. Address: http://masonry.desandro.com/index.html It contains many examples.
Process:
1. When the page is initialized, the plug-in is called to perform layout once;
2. When the user drags the scroll bar to the bottom, use ajax to load the data once and format it for display
3. Repeat 2 until there is no data
Html code:
Action code:
Note: Determine whether to use ajax to load data once by judging whether the window has scrolled to the bottom of the page. If it is not processed, it will be requested many times at once, so conditions must be used to limit it.
What is used here is to assign a value to an element $("#loading").data("on", true);. If it is judged to be true during the request, the request will not continue, and then the value will be assigned after the page request is completed. false.
I hope this article will be helpful to everyone’s ThinkPHP framework programming.