在HTML中的移动网页浏览器上下拉刷新

在HTML中的移动网页浏览器上下拉刷新

当需要下拉屏幕以刷新页面以获取最新更新时,可以借助JavaScript、xhttprequests和触摸事件来实现。

下拉刷新是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中的移动网页浏览器上下拉刷新的详细内容,更多请关注编程之家其它相关文章!

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些