0

I'm using infiniteajaxscrolling, but my initial ajax call often (depending on screen size) doesn't contain enough content that it shows a scroll bar.

Without scrollbar, there is no scroll event => infinite scrolling never starts?

How can I let ias load content until there are at least scrollbars visible?

(except of course, just coding it myself ).

Is there something like this already implemented in ias I just have to activate?

I tried just calling ias.next() on a "rendered" event, but that funnily gets to duplicated loading of content. I suppose because somehow a scroll event gets triggered then...

Community
  • 1
  • 1
JoeSchr
  • 1,067
  • 1
  • 9
  • 14
  • IAS should automatically load the next page when content is shorter then the viewport. This is actually a feature of IAS. It's kinda strange that's not working for you... which version or IAS are you using? – Fieg Jan 27 '15 at 15:03
  • Hi, I'm using the newest one, I just cloned it from github last week. Maybe it get's thrown off because I'm using something like a "slide" setup (body is 100% width&height, section make up pages with position:absolute and I smooth scroll to them) – JoeSchr Jan 28 '15 at 12:31

1 Answers1

0

Ok, it seems, the problem is, that the next url gets loaded AFTER "rendered" is called. Don't ask me why...

This seems like a pretty painless way to fix it without being to "hackish". Just fast-forwarding loading of the new next url. Doesn't seem to break anything in my testing...

ias.on("loaded", $.proxy(function(data, items)
{
    this.nextUrl = this.getNextUrl(data); // fast forward for next() in on.'rendered'
}, ias));

ias.on('rendered',$.proxy(function(items)
{
   if($(CONTAINER).height() <= $(window).height()) // call until scroll bars are shown
   {
      this.next();
   }
}), ias);
JoeSchr
  • 1,067
  • 1
  • 9
  • 14