<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<table>
<tr>
<td>
Window Scroll :
</td>
<td>0</td>
<td>
Document height :
</td><td>0</td>
<td>
Window Height :
</td><td>0</td>
</tr>
</table>
<div id="content" align="center">
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
This is My Content<br/>
</pre>
<div id="loading">
Loading Please Wait......
</div>
</div>
</div>
var count=0;
$(document).ready(function(){
SetValues();
$(window).scroll(function(){
//Will check if the user has reached bottom of a PAGE
SetValues();
//Check for user has reached bottom of Page
if($(window).scrollTop()==($(document).height()-window.innerHeight)){
$('#loading').fadeIn();
setTimeout("appendContent()", 1000);
}
});
});
var appendContent=function(){
//alert("You are At Bottom");
$('#content').append("@@@@@@@@@ ---------- "+count+" TIMES ---------- @@@@@@@@@<br/>");
count++;
for(var i=0;i<10;i++){
alert(i);
$('#content').append("This is Dynamic Added Content<br/>");
}
$('#loading').fadeOut();
};
var SetValues=function(){
$('table tr:first-child td:nth-child(2)').html($(window).scrollTop());
$('table tr:first-child td:nth-child(4)').html($(document).height());
$('table tr:first-child td:nth-child(6)').html(window.innerHeight);//$(window).height()
};