natural-gallery-js icon indicating copy to clipboard operation
natural-gallery-js copied to clipboard

Can't get infinite scroll to work

Open brianjenkins94 opened this issue 2 years ago • 1 comments

CodeSandbox: https://codesandbox.io/s/natural-gallery-js-issue-czh8cg

My best guess is I'm using setItems() when maybe I should be using addItems()?

brianjenkins94 avatar Jun 11 '23 20:06 brianjenkins94

Anything look obviously wrong in that CodeSandbox?

brianjenkins94 avatar Aug 21 '23 14:08 brianjenkins94

Nothing obvious from my side and I can't run your demo.

As gallery has been updated since then, I think this issue as already been addressed.

technical word anyway : gallery resizes itself to fill the viewport and allow the infinite scroll. If for some reason it can't expand it's wrapper, and has a height of 0 after initialisation, it will work without infinite scroll, because content never expands bellow visible viewport.

sambaptista avatar Aug 10 '25 19:08 sambaptista

Updated the sandbox, try now @sambaptista:

https://codesandbox.io/p/sandbox/natural-gallery-js-issue-czh8cg

brianjenkins94 avatar Aug 10 '25 19:08 brianjenkins94

Issue persists, kindly reopen 🙂

brianjenkins94 avatar Aug 11 '25 16:08 brianjenkins94

It seems to be due to the wrapping into id="main".

If I remove this "useless" wrapper, it works. Do you need it for some reason ?

sambaptista avatar Aug 11 '25 16:08 sambaptista

On your exact demo, the overflow is managed by the body, but you provide id="main"element as the scrollable element (3rd argument). The gallery does not detect the scroll because there is no scroll on this element.

You can just remove the 3rd argument when instantiating gallery and it works.

Good continuation :)

sambaptista avatar Aug 11 '25 17:08 sambaptista