JSFiddle - React, Tailwind, and code Playground
HTML
<div id="buchanfr">
<div class="loader"></div>
<div class="container"></div>
<div class="end"></div>
</div>
CSS
#buchanfr {
height: 157px;
overflow: auto;
width: 750px;
}
JavaScript
$(document).ready(function() {
start = 0;
count = 5;
for (var i = 0; i < 1; i++){
loadcontent();
}
});
function loadcontent() {
$("div.loader").show();
$.ajax({
type: 'get',
url: '/includes/ajax.php',
async: false,
data: { start : start, count : count },
success: function (html){
if(html){
$('.container').append(html);
start = start + 5;
}else{
$('.end').html('<p>Keine weiteren Posts!</p>');
}
}
})
$("div.loader").fadeOut('normal');
}
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
loadcontent();
}
});