H5 Pull-Down Refresh and Pull-Up Load More

Add-ons
2026-07-26 00:37 4 次浏览 • 0 次下载 13.6KB
H5 Pull-Down Refresh and Pull-Up Load More

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
}
});
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare