szurubooru/public_html/media/js/paginator-endless.js
Marcin Kurczewski 8fdc90bab7 Worked on #4, #1 and #2
Also:
- enhanced form stylesheets
- W3C validation
2013-10-15 00:41:04 +02:00

32 lines
836 B
JavaScript

function scrolled()
{
var margin = 150;
if ($(document).height() <= $(window).scrollTop() + $(window).height() + margin)
{
var pageNext = $(document).data('page-next');
var pageDone = $(document).data('page-done');
if (pageNext == null)
{
pageNext = $('.paginator .next:not(.disabled) a').attr('href');
}
if (pageNext != null && pageNext != pageDone)
{
$(document).data('page-done', pageNext);
$.get(pageNext, [], function(response)
{
var dom = $(response);
var nextPage = dom.find('.paginator .next:not(.disabled) a').attr('href');
$(document).data('page-next', nextPage);
$('.paginator-content').append($(response).find('.paginator-content').children().fadeIn('slow'));
scrolled();
});
}
}
}
$(function()
{
$('.paginator').hide();
$(window).scroll(scrolled);
scrolled();
});