下拉刷新是ajax中xhr的触发器。它向我们想要的元素添加新数据。
可以通过劫持javascript滚动机制(如iscroll)来实现下拉刷新。twitter正在使用iscroll来实现下拉刷新选项。
另一种方式是为overflow:scroll组件创建一个刷新处理程序。
提供的接口可以给出有关处理程序接口的想法−
var pulltorefresh= function(callback, wrapper, instructionstext) { //it creates dom elements and append them before content wrapper // <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. // scroll main wrapper. // invoke initializeevents() to inititalize the events};
以上就是在html中的移动网页浏览器上下拉刷新的详细内容。
