2013-10-09 12:18:22 +02:00
|
|
|
function scrolled()
|
|
|
|
{
|
|
|
|
var margin = 150;
|
2014-03-02 18:45:37 +01:00
|
|
|
var target = $('.paginator-content:eq(0)');
|
|
|
|
var y = $(window).scrollTop() + $(window).height();
|
|
|
|
var maxY = target.height() + target.position().top;
|
|
|
|
if (y >= maxY - margin)
|
2013-10-09 12:18:22 +02:00
|
|
|
{
|
|
|
|
var pageNext = $(document).data('page-next');
|
|
|
|
var pageDone = $(document).data('page-done');
|
|
|
|
if (pageNext == null)
|
|
|
|
{
|
2013-10-15 00:41:04 +02:00
|
|
|
pageNext = $('.paginator .next:not(.disabled) a').attr('href');
|
2013-10-09 12:18:22 +02:00
|
|
|
}
|
|
|
|
if (pageNext != null && pageNext != pageDone)
|
|
|
|
{
|
|
|
|
$(document).data('page-done', pageNext);
|
2014-05-15 23:11:53 +02:00
|
|
|
$.get(pageNext).success(function(response)
|
2013-10-09 12:18:22 +02:00
|
|
|
{
|
|
|
|
var dom = $(response);
|
2013-10-15 00:41:04 +02:00
|
|
|
var nextPage = dom.find('.paginator .next:not(.disabled) a').attr('href');
|
2013-10-09 12:18:22 +02:00
|
|
|
$(document).data('page-next', nextPage);
|
2014-03-02 18:45:37 +01:00
|
|
|
|
|
|
|
var source = $(response).find('.paginator-content');
|
|
|
|
target.append(source
|
|
|
|
.children()
|
|
|
|
.css({opacity: 0})
|
|
|
|
.animate({opacity: 1}, 'slow'));
|
|
|
|
|
2013-11-05 09:17:44 +01:00
|
|
|
$('body').trigger('dom-update');
|
2013-10-13 21:48:14 +02:00
|
|
|
scrolled();
|
2013-10-09 12:18:22 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$(function()
|
|
|
|
{
|
|
|
|
$('.paginator').hide();
|
|
|
|
$(window).scroll(scrolled);
|
|
|
|
scrolled();
|
|
|
|
});
|