fixed unworking infinite scroll

This commit is contained in:
Dmitriy Zaporozhets 2012-02-12 23:52:27 +02:00
parent 48bc4fc214
commit ece9f50fb1
11 changed files with 180 additions and 66 deletions

View file

@ -3,6 +3,7 @@ var NoteList = {
first_id: 0,
last_id: 0,
resource_name: null,
disable:false,
init:
function(resource_name, first_id, last_id) {
@ -26,9 +27,12 @@ getOld:
append:
function(id, html) {
this.first_id = id;
$("#notes-list").append(html);
this.initLoadMore();
if(this.first_id == id) {
this.disable = true;
} else {
this.first_id = id;
$("#notes-list").append(html);
}
},
replace:
@ -76,11 +80,16 @@ initRefresh:
initLoadMore:
function() {
$(window).bind('scroll', function(){
if($(window).scrollTop() == $(document).height() - $(window).height()){
$(window).unbind('scroll');
$(document).endlessScroll({
bottomPixels: 400,
fireDelay: 1000,
fireOnce:true,
ceaseFire: function() {
return NoteList.disable;
},
callback: function(i) {
NoteList.getOld();
}
});
});
}
}