v1.18.x
Barış Soner Uşaklı 7 years ago
parent 1f8b4bf820
commit 017b10d5d6

@ -27,5 +27,13 @@ define('forum/pagination', function () {
ajaxify.go(url, callback);
};
pagination.nextPage = function (callback) {
pagination.loadPage(ajaxify.data.pagination.currentPage + 1, callback);
};
pagination.previousPage = function (callback) {
pagination.loadPage(ajaxify.data.pagination.currentPage - 1, callback);
};
return pagination;
});

@ -212,14 +212,32 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co
}
navigator.scrollUp = function () {
var $window = $(window);
if (config.usePagination) {
var atTop = $window.scrollTop() <= 0;
if (atTop) {
return pagination.previousPage(function () {
$('body,html').scrollTop($(document).height() - $window.height());
});
}
}
$('body,html').animate({
scrollTop: $(window).scrollTop() - $(window).height(),
scrollTop: $window.scrollTop() - $window.height(),
});
};
navigator.scrollDown = function () {
var $window = $(window);
if (config.usePagination) {
var atBottom = $window.scrollTop() >= $(document).height() - $window.height();
if (atBottom) {
return pagination.nextPage();
}
}
$('body,html').animate({
scrollTop: $(window).scrollTop() + $(window).height(),
scrollTop: $window.scrollTop() + $window.height(),
});
};

Loading…
Cancel
Save