I want to create a feature similar to Facebook where more results are loaded when the page is scrolled down. I need to style both an outer and inner div for this implementation.
.Outer{
height: 1430px;
margin-top: -12px;
overflow: hidden;
width: 99%;
}
.inner {
height: 1435px;
overflow-y: scroll;
position: relative;
width: 103%;
}
To achieve this, I have two div elements named Inner and Outer. I have added an inline onscroll function to the inner div. Currently, I am able to scroll through records inside the Inner div without showing a scrollbar, with 10 records loaded initially. When I reach the 7th record while scrolling, I want to make a server call to fetch 10 more results and append them to the Inner div.
What is the best method to determine the scroll position at the 7th record and initiate a server action?
Considering that the website needs to be responsive, will the onscroll function work effectively on all devices? Are there any better approaches to meet this requirement?