拉动刷新 Javascript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8110736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pull to Refresh Javascript
提问by Satch3000
I am using JQuery Mobile and I've seen a couple of Pull to Refresh Scripts around.
我正在使用 JQuery Mobile,并且我已经看到了几个 Pull to Refresh 脚本。
I especially like this onebut even the demo doesn't seem to work on their website.
我特别喜欢这个,但即使是演示似乎也无法在他们的网站上运行。
My question is ... does anyone know of any working pull to refresh scripts for web apps?
我的问题是......有没有人知道刷新网络应用程序脚本的任何工作?
回答by J. K.
Here is an examplary implementation: http://cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/
这是一个示例实现:http: //cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/
iScrollwas used.
回答by zippy1978
I have built my own jQuery / jQuery Mobile plugin (pull to refresh and infinite scrolling are supported): https://github.com/zippy1978/jquery.scrollz
我已经构建了自己的 jQuery / jQuery Mobile 插件(支持下拉刷新和无限滚动):https: //github.com/zippy1978/jquery.scrollz
回答by Ir Calif
$("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 + ' %');
})
});
});