Hello guys I have a parent div and multiple child div. and I have a scroll which can be moved up and down to view the child. Now I want to know that is there a way that when I scroll down or up then using jquery I would see which child div is in focus. Is there any way to do that. If yes please tell. Thanks
Here is a example
<div id="parent" style="overflow:scroll; height:200px">
<div id="child1">
<p>
some text
</p>
</div>
<div id="child2">
<p>
some text
</p>
</div>
<div id="child3">
<p>
some text
</p>
</div>
</div>
Now this becomes like this image. Now as I scroll down then how can I know which child div which is in focus. Every time the user moves the scroll how will I know which div is in focus.
$( '#parent' ).scroll(function() {
//What shoult I write here to know which child div is in focus
});