Infinite scrolling in native javascript