<script>
$(document).ready(function(){
var inProgress=false;
var startFrom=10;
$('#data').scroll(function (){
if( this.scrollTop <= 100 && !inProgress ){
$.ajax({
url:'ajaxlogs.php',
method:'POST',
data:{"startFrom":startFrom},
beforeSend:function(){inProgress=true;
}
}).done(function(data){
data=jQuery.parseJSON(data);
if(data.length>0){
$.each(data, function(index, data){
$(".my_cont").prepend('<p class="ogl">' + data.title + '</p><div class="box">' + data.text + '</div>');
});
inProgress=false;
startFrom +=10;
}
});
}
});
});
var block = document.getElementById("data");
block.scrollTop = 9999;
</script>
<script>
$(document).ready(function(){
var inProgress=false;
var startFrom=10;
var div = $('.my_cont'),
div_sh = $(div)[0].scrollHeight,
div_h = div.height();
$(div).scroll(function(){
if ($(this).scrollTop() >= div_sh - div_h && !inProgress ){
$.ajax({
url:'ajaxlogs.php',
method:'POST',
data:{"startFrom":startFrom},
beforeSend:function(){inProgress=true;
}
}).done(function(data){
data=jQuery.parseJSON(data);
if(data.length>0){
$.each(data, function(index, data){
$(".my_cont").append('<p class="ogl">' + data.title + '</p><div class="box">' + data.text + '</div>');
});
inProgress=false;
startFrom +=10;
}
});
}
});
});
</script>