H5 Pull-Down Refresh and Pull-Up Load More
Add-ons

Plugin Description: H5 pull-down refresh and pull-up load more functionality. Smooth performance without lag and no dependencies.
Usage
1) Add two elements to the page
1 2 3 4 | <div id="demo"> <div style="text-align:center">Loading...</div></div><div class="x-pullfresh-more">Load More</div> |
2) Data Loading Method
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | pullrefresh.doRefresh({ debug: true, // Simulate a real data request to avoid AJAX cross-origin errors. For production use, remove the debug code from h5.js. url: './list.json', // Required: URL for the AJAX data request data: { size: 20 }, // Optional: Parameters for the AJAX request. If caching is enabled, these will affect the browser's cached data. dataType: "json", // Optional: Data type returned by the AJAX request container: '#demo', // Optional: Used to determine the document.body.scrollTop value at which more data is automatically loaded cache: 'test', // Optional: Set to false if you do not want the browser to cache data; otherwise, provide a unique identifier. See sessionStorage for details. success: function(list, page, size) { // Data returned by the server after a successful AJAX request // Process the data returned by the server here and bind it to the demo element return true; // Return true if more data is available; return false if there is no more data. This is how I usually implement it. return list.length >= size }}); |
评论