endlessscroll - How to call ceaseFire in jquery endless scroll -
var lazyloadlist = { zeroresult:'', loadlist:function(url,templatename,callbackaction,divid){ this.zeroresult = false; $(document).endlessscroll({ //pagestokeep: 10, fireonce: false, callback: callbackaction, ajaxurl: url, templatename: templatename, dividtoupdate: divid, ceasefireonempty:true, ceasefire: function(i, p) { return this.zeroresult; }, intervalfrequency: 5 }); }, getlist:function(firesequence, pagesequence, scrolldirection, ajaxurl, templatename, dividtoupdate){ if (pagesequence > 1) { var requesturl = ajaxurl + pagesequence; $.ajax({ url: requesturl, datatype: 'json', complete: function() { }, success: function(response){ if (response != '0'){ var template = $("#"+templatename).html(); detailview = mustache.render(template, response.data); $("#"+dividtoupdate).append(detailview); //servicelisttemplatediv }else{ this.zeroresult = true; } } }); } } };
in above code jquery endless scroll plugin. have 2 questions regarding above code:-
1- how call ceasefire when this.zeroresult true?
2- how stop callback when scrolled in upward direction, have handled using if (pagesequence > 1) {} in above code?
use lazyloadlist.zeroresult instead of this.zeroresult
class names important , should used call/ access variables , methods
Comments
Post a Comment