<script>
$(document).ready(function(){
var inProgress=false;
var startFrom=10;
$('#data').scroll(function (){
if(this.scrollTop === 0 && !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;
}
});
}
});
});
var block = document.getElementById("data");
block.scrollTop = 9999;
</script>
<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>