Following is the piece of code that gets more content from DB when scrolled down. Its mainly JQuery.
I don't understand why it works when height is changed as 100px, but it doesn't work when height is given as 100% or auto.
<div id="contentBox" style="overflow: scroll;width: 200px; height: 100px;">
<div id="actualContent">
<p>
<span>2</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ornare facilisis mollis. Etiam non sem massa, a gravida nunc. Mauris lectus augue, posuere at viverra sed, dignissim sed libero.
</p>
<p>
<span>3</span>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ornare facilisis mollis. Etiam non sem massa, a gravida nunc. Mauris lectus augue, posuere at viverra sed, dignissim sed libero.
</p>
</div>
</div>
$("#contentBox").scroll(function(){
if($("#contentBox").scrollTop() >= ($("#actualContent").height() - $("#contentBox").height())){
alert("Hi");
}
});
Here is the link: https://jsfiddle.net/8qv2ch9u/
How to make it work without height 100px, but the content filling the size of the browser?