metafizzy / infinite-scroll

📜 Automatically add next page
https://infinite-scroll.com
7.41k stars 1.74k forks source link

Prefill doesn't seem to have an effect #881

Open arminus opened 5 years ago

arminus commented 5 years ago

How do I get prefill to work? Take the following slightly modified example:

Test case: https://codepen.io/armin-m-ller/pen/OYQjyj

Resize the browser window to < 780px, this will result in all initially loaded images to fit completely, i.e. there will be no scroll bar and subsequently, no way for the user to trigger loading the next page(s).

Expected behavior: prefill option to actually load the 2nd page in case all images fit on the first load..

arminus commented 5 years ago

Also, I noticed another "issue": adding per_page=50 to the api.unsplash.com request in the above example (or some reasonable per page value based on the container dimension) might be a way to make sure that enough is loaded - but in this case there is no progress whatsoever until all images are loaded. This is bad with slow image requests in which case apparently nothing happens for a while. So the follow-up issue/question here is how to avoid that and get images to be displayed as the finish loading individually?

arminus commented 5 years ago

Ok, the answer to the 2nd issue is actually in Masonry#501.

desandro commented 5 years ago

Thanks for reporting this issue. This is indeed a bug. When using Masonry with outlayer, the append event gets triggered, as elements are added to the page, but then images have to load. I'll have to dig deeper and figure out where the disconnect is.

arminus commented 5 years ago

Meanwhile I'm working around this with mediaqueries which change the grid item width in a way that the visible grid canvas should always overflow.

agdgdh commented 3 years ago

How do I get prefill to work? Take the following slightly modified example:

Test case: https://codepen.io/armin-m-ller/pen/OYQjyj

Resize the browser window to < 780px, this will result in all initially loaded images to fit completely, i.e. there will be no scroll bar and subsequently, no way for the user to trigger loading the next page(s).

Expected behavior: prefill option to actually load the 2nd page in case all images fit on the first load..

Hi