I am working with a large number of div
elements (around 4000). The first time the page loads, only the first div
is set to have a style of display: block
, while all others are hidden with display: none
. Additionally, each div
has a different height.
<div id="maincontainer">
<div class="child" style="height:300px;display:block;">page1</div>
<div class="child" style="height:400px;display:none;">page2</div>
<div class="child" style="height:200px;display:none;">page2</div>
<div class="child" style="height:100px;display:none;">page2</div>
<div class="child" style="height:500px;display:none;">page2</div>
<div class="child" style="height:600px;display:none;">page2</div>
<div class="child" style="height:500px;display:none;">page2</div>
<div class="child" style="height:100px;display:none;">page2</div>
<div class="child" style="height:400px;display:none;">page2</div>
</div>
I am looking to implement a feature where as the user scrolls down the page, the next div element
in view will be displayed. This should continue until the last div element
is reached. Can someone provide guidance on how I can achieve this functionality?