【发布时间】:2011-11-13 09:35:25
【问题描述】:
我正在使用 JQuery Mobile,我已经看到了几个 Pull to Refresh Scripts。
我特别喜欢this one,但即使是演示也似乎无法在他们的网站上运行。
我的问题是...有谁知道刷新网络应用脚本的任何有效拉动?
【问题讨论】:
标签: javascript jquery jquery-mobile
我正在使用 JQuery Mobile,我已经看到了几个 Pull to Refresh Scripts。
我特别喜欢this one,但即使是演示也似乎无法在他们的网站上运行。
我的问题是...有谁知道刷新网络应用脚本的任何有效拉动?
【问题讨论】:
标签: javascript jquery jquery-mobile
【讨论】:
我已经构建了自己的 jQuery / jQuery Mobile 插件(支持拉动刷新和无限滚动):https://github.com/zippy1978/jquery.scrollz
【讨论】:
$("body").ready(function _onbodyready() {
var $feedback = $('#feedback');
$("#main-content-div")
.pullToRefresh()
.on("end.pulltorefresh", function (e, percent){
$feedback.html("ok");
})
.on("move.pulltorefresh", function (e, percent){
$feedback.html(percent + ' %');
})
});
【讨论】:
在这里强烈推荐Pull to Refresh 库。刚刚实施,效果很好。
对于基本功能,请访问他们的GitHub 并下载 index.umd.min.js 文件并将其包含在内。然后,使用以下代码:
PullToRefresh.init({
mainElement: '#main_div',
onRefresh: function() { location.reload(); }
});
这将模仿您在this demo 中看到的功能
【讨论】: