View file profile/templates/profile/reels.html

File size: 1.14Kb
<div class="container user-posts__container">
	<div class="user-posts explore-posts-container pg_grid_posts pg_grid_posts_tag">
		<?php if (count($context['posts']) > 0) {
			foreach ($context['posts'] as $key => $post_data) {
				include 'includes/reels_list.html';
			}
		} else{
			include 'includes/no-posted.html';
		} ?>
	</div>
</div>

<script>
	var ajax_url = '<?php echo($context['xhr_url']); ?>';
	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 && $('.user-postset').length > 0) {
	                scrolled = 1;
	                var list_ids = $("div.user-postset[id]").map(function() {
	                	if($(this).attr('id') > 0) {
							return $(this).attr('id');
						}
		            }).get();

		            if (!list_ids) {
		                return false;
		            }

    				var last_id  = Math.min.apply(Math,list_ids);
	       		}
		    }
		});
	});
</script>