在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中的移动网页浏览器上下拉刷新的详细内容,更多请关注双恒网络其它相关文章!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。