File size: 1.27Kb
<?php if ($context['followers_ls'] > 0 ) { ?>
<div class="container pg_grid_ppl_sugg">
<div class="row people followers--ls">
<?php foreach ($context['followers_ls'] as $key => $udata) {
include 'includes/followers-ls-item.html';
} ?>
</div>
</div>
<script>
var user_id = '<?php echo $context['user_data']['user_id'] ?>';
jQuery(document).ready(function($) {
var scrolled = 0;
var last_id = 0;
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
if (scrolled == 0) {
scrolled = 1;
var last_id = 0;
if ($('.followers--ls__item').length > 0) {
last_id = $('.followers--ls__item:last').attr('id');
}
if (!last_id) { return; }
$.ajax({
url: xhr_url() + 'profile/load-user-followers',
type: 'GET',
dataType: 'json',
data: {
offset:last_id,
user_id:user_id
},
}).done(function(data) {
if (data.status == 200) {
$(".followers--ls").append($(data.html));
scrolled = 0;
}
else{
$(window).unbind('scroll');
}
});
}
}
});
});
</script>
<?php } ?>