I wish to implement infinite scrolling with javascript and without jquery.
I am new to javascript.
After searching all over the net, I have this code.
For achieving that behaviour you don't need JQuery
or a JQuery plugin
. You just need Pure Css OR Css + Javascript
, it depends on the % you want to support
but... DON'T use onScroll
: you can do all that just with Vanilla Javascript
and the IntersectionObserver API
.
All you need to do is place elements and listen for when they become available in the screen. You can accomplish that with a few javascript & html lines and it's much more performant than listening for scroll events in the browsers
I recently put together an article check it here about this