滚动库-到达页面的末端-回调或绑定
iScroll library - end of page reached - callback or binding?
我试图挂钩函数回调时,isroll容器到达页面的末尾,在底部(y轴)。这样我就可以按需加载更多的内容,而不是所有的300多个内容。
有人在做吗?有提示吗?
这里是我所指的库:http://cubiq.org/iscroll-4
正如上文提到的,你应该查看Pull来刷新demo
http://cubiq.org/dropbox/iscroll4/examples/pull-to-refresh/你需要建立你自己的逻辑,不需要用户拉来添加更多的项目。
类似于(伪代码-未经测试的代码):
var isAlreadyLoading = 0;
var iscroller = new iScroll(
'your-element-id',
{
hScroll: false,
bounce: false, // do not bounce
onScrollMove: function () {
// CHECK if we've 350px gap before reaching end of the page
if ( (this.y < (this.maxScrollY + 350)) && (isAlreadyLoading == 0) ){
// start loading next page content here
// update this flag inside load more and set to 0 when complete
isAlreadyLoading = 1;
}
},
onScrollEnd: function () {
// check if we went down, and then load content
if ( isAlreadyLoading == 0 ) {
// Load more content
// update this flag inside load more and set to 0 when complete
isAlreadyLoading = 1;
} else {
// DO NOTHING
}
}
} // end of Scoller config object
); // end iScroll instance
相关文章:
- 为什么prototypjs观察到回调函数有绑定
- 在Backbone.js中将回调绑定到此
- 将web服务回调的结果绑定到Javascript中的调用函数
- 将回调绑定到没有隔离作用域的指令
- 将其绑定在 backbone.js 中的 jQuery 回调中
- 将类方法绑定到类外绑定的事件处理程序内的AJAX成功回调
- KnockoutJS在绑定完成后触发回调
- 使用闭包/函数绑定将自函数作为回调传递
- 当通过Ajax成功回调更新可观察数组时,启用绑定中断
- 异步加载ASP.NET绑定的Javascript,然后调用回调
- 绑定promise回调函数的“this”范围
- 处理Ember中操作中的事件绑定和回调
- 如何绑定'这'到react类之外的函数,后者是来自其他组件的回调
- G+ 登录按钮回调绑定两次
- Backbone.js On Trigger回调绑定未按预期工作
- 在javascript中使用promise和原型时,优雅的回调绑定
- 将函数回调绑定到剑道网格
- 将ES7异步回调绑定到父作用域上下文的最简洁的方法是什么?
- Angular 1.5组件回调绑定没有执行
- 将回调绑定到 DynamoDB DocumentClient 的 ReactJS 状态