metafizzy / infinite-scroll

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

Appended content is loaded above button #923

Open mtt-shane opened 3 years ago

mtt-shane commented 3 years ago

When using the "button" loading method, my content was being loaded above the button, requiring the user to scroll up to view new content rather than down. It seems this is due to new browser scroll anchoring behavior. The fix was to add the CSS property overflow-anchor: none; to the button container.

subfighter3 commented 3 years ago

Hi! Same issue here. It also happen when the threshold is reached, it just load the content above, sometimes with no chance to notice that something new has loaded. This issue struggle me from a long time.

subfighter3 commented 3 years ago

Thank you @mtt-shane, your fix worked, but only when applying overflow-anchor: none; to the body element. It doesn't work if applied to any of the button ancestors. Anyway this solved my struggles!

kikoalonsob commented 3 years ago

Thanks @mtt-shane, this made my day! I confirm that applying that style to the button's parent element the problem is fixed.

desandro commented 3 years ago

Thank you for reporting this issue and fix. I'll have to add this to the docs.

AlDeveci commented 2 years ago

I have set back my forgotten pw just to say thank you!!!