Database requests

This commit is contained in:
Michał Gdula 2022-12-19 21:15:56 +00:00
parent f41312248c
commit 594431b420
8 changed files with 84 additions and 42 deletions

View file

@ -12,10 +12,10 @@
let imageList = [];
let imageIndex = 0;
function loadMore(startIndex, amount = 10) {
function loadMore(startIndex, amount = 20) {
for (let i = startIndex; i < startIndex + amount; i++) {
if (i < imageList.length) {
loadImg(i, imageList[i]);
loadImg(imageList[i][0], imageList[i][1]);
}
}
}
@ -41,13 +41,13 @@
success: function(response) {
imageList = response;
loadMore(0, 20);
imageIndex += 20;
loadMore(0, 30);
imageIndex += 30;
}
});
$(window).scroll(function() {
if ($(window).height() + $(window).scrollTop() >= $(document).height() - 200) {
if ($(window).height() + $(window).scrollTop() >= $(document).height() - 500) {
loadMore(imageIndex);
imageIndex += 10;
}