My page ui keep freezing each time the load more is fire once or multiple times to load more videos and all the videos play button get freeze/hang. Here is the PHP code
It unfreeze back only when data has loaded, Any help is appreciated. I have tried lots of solution by turning async to true but same freezing
if(isset($_REQUEST["limit"], $_REQUEST["start"])){
$sSQL='SELECT * from posts WHERE
created_at >= DATE(NOW()) + INTERVAL
-2 DAY
order by uni
';
$result = $db->getRecFrmQry($sSQL.' LIMIT '.$_REQUEST["start"].', '.$_REQUEST["limit"].' ');}
foreach($result as $val){
?>
<div class="section" style="background:black;margin-bottom:-35px">
<video style="margin-bottom:-150px"
poster="bgv.png"
x5-playsinline="" playsinline="" webkit-playsinline="" x5-video-player-type="h5" x-webkit-airplay="true">
<source src="/ver/videos/<?php echo $val['video']; ?>" type="video/mp4">
</video>
It unfreeze back only when data has loaded using this jQuery code
$(document).ready(function(){
var limit = 2;
var start = 0;
var action = 'inactive';
function load_country_data(limit, start)
{
$.ajax({
url:"listing-data.ajax.php",
method:"GET",
data:{limit:limit, start:start},
cache:false,
success:function(data)
{
$('#load_data').append(data);
if(data == '')
{
$('#load_data_message').html("<button type='button' class='btn btn-info'>No Data Found</button>");
action = 'active';
}
else
{
$('#load_data_message').html("<center><i class='fas fa-spinner fa-spin' style='font-size:35px,color:white'></i></center>");
action = "inactive";
}
}
});
}
if(action == 'inactive')
{
action = 'active';
load_country_data(limit, start);
}
$(window).scroll(function(){
if($(window).scrollTop() + $(window).height()+100 > $("#load_data").height() && action == 'inactive')
{
action = 'active';
start = start + limit;
setTimeout(function(){
load_country_data(limit, start);
}, 10);
}
});
});