Search code examples
jqueryajaxscroller

jquery infinite scroller


I would like to load content while scrolling with jquery an I found something useful but doesn't work for me:

link: http://www.webresourcesdepot.com/load-content-while-scrolling-with-jquery/

in Firefox i successfully make 5 ajax calls and append content on bottom but then it stops working. what could go wrong?

Code when i call ajax function is bellow:

$(window).scroll(function(){
    if  ($(window).scrollTop() == $(document).height() - $(window).height()){
       ajax
    }
});

is it possible to make ajax calls 100 px before scroller reach bottom?

@Val code on jsfiddle works with its condition:

if ($(window).scrollTop() >= ($(document).height()) - $(window).height() - 100){}

it is weird that in ff doesn't work with this condition when I reach bottom

if ($(window).scrollTop() == ($(document).height()) - $(window).height()){}

in firefox I make 6 ajax posts with second condition but then it stops working...

Any explanation for that?


Solution

  • ok this, could take a long time, [trying to explain] but hopefully this will help

    http://demo.webdeveloperplus.com/dynamic-scrollbox/ [thats the demo ]

    http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/ [that is the how to]