Possible to pull random 10 entries (without duplicating entries) with ajax everytime when scroll to the bottom, right now it loads random 10 entires but it duplicates and some entries never shows up. Any ideas? thanks
index.html:
{exp:channel:entries channel="channel_A|channel_B|channel_C" orderby="random" limit="10"}
{content}
{/exp:channel:entries}
ajax/index.html
{exp:channel:entries channel="channel_A|channel_B|channel_C" orderby="random" limit="10"}
{content}
{paginate}
{pagination_links}
<ul class="lepaginate">
{page}
<li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
{/page}
</ul>
{/pagination_links}
{/paginate}
{/exp:channel:entries}
jquery:
var counter = 10;
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
var response;
$.ajax({ type: "GET",
url: ""+document.location.origin+"/ajax/P"+counter+"",
async: false,
success : function(text) {
response = text;
}
});
counter += 10 ;
newItems = $(response).appendTo('.grid');
$grid.isotope('appended', newItems );
var $grid = $('.grid').isotope({
masonry: {
columnWidth: 360,
gutter: 30
}
});
}
});
this is using pagination, so it loads like '/ajax/P10' '/ajax/P20' ..., etc
paginate="hidden"
? I'm not sure it works, but maybe it worth to try.