Intersection Observer API - Web APIs | MDN — Perhaps this could help with infinite scrolling.