javascript - scroll event has some strange behavior -


i have type of problem.

i have scroll event checking if have reached end of page , fetches data server , part working correctly.

problem have on older computers have problem of getting double items loaded when scroll event happens.

what make code work working on faster computers...

i tried delay() code inside scroll event , same thing happening...

code:

$(window).scroll(function()  {     if($(window).scrolltop() + $(window).height() == $(document).height())      {        $(".loader").show().delay(700).fadeout();        $.ajax({ ///more code });     } }); 

var loading = false; $(window).scroll(function()  {     if($(window).scrolltop() + $(window).height() == $(document).height())      {       if(!loading){        loading = true;        $(".loader").show().delay(700).fadeout();        $.ajax({ ///more code })        .done(function(){           loading = false;        });       }     } }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -