下拉以刷新HTML格式的移动网络浏览器。
如果需要下拉屏幕以刷新页面以获取最新更新,可以在JavaScript,xhttprequests和touch事件的帮助下完成此操作。
拉刷新是AJAX中XHR的触发器,它将新数据添加到所需的元素中。
可以使用劫持的JavaScript滚动机制(例如iscroll)来实现拉刷新。Twitter正在使用iscroll拉刷新选项。
另一种方法是为溢出的:scroll组件创建刷新处理程序。
提供的接口可以提供有关处理程序接口的想法-
var PullToRefresh= function(callback, wrapper, instructionsText) {
//它创建dom元素并将其附加在内容包装器之前
// <div class="mainWrapper" style="overflow: scroll; height: 600px;">
<div class="pullToReloadWrapper"></div><div class = "contentWrapper"></div>
</div> is the markup.
// if main wrapper's height is > than content wrapper's
height, then change the main wrapper height to be the height of the content wrapper.
//滚动主包装。
// invoke initializeEvents() to inititalize the events
};