poprawki
This commit is contained in:
@@ -9,8 +9,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
return str ? str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase() : '';
|
||||
}
|
||||
|
||||
let sortMode = 'popularity'; // 'popularity' lub 'alphabetical'
|
||||
let limit = 50;
|
||||
let sortMode = 'popularity';
|
||||
let limit = 150;
|
||||
let offset = 0;
|
||||
let loading = false;
|
||||
let reachedEnd = false;
|
||||
@@ -20,7 +20,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
function renderSortBar() {
|
||||
if (!sortBar) return;
|
||||
sortBar.innerHTML = `
|
||||
<a href="#" id="sort-popularity" ${sortMode === "popularity" ? 'style="font-weight:bold"' : ''}>Sortuj: Popularność</a> |
|
||||
Sortuj: <a href="#" id="sort-popularity" ${sortMode === "popularity" ? 'style="font-weight:bold"' : ''}>Popularność</a> |
|
||||
<a href="#" id="sort-alphabetical" ${sortMode === "alphabetical" ? 'style="font-weight:bold"' : ''}>Alfabetycznie</a>
|
||||
`;
|
||||
document.getElementById('sort-popularity').onclick = (e) => {
|
||||
@@ -152,8 +152,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
// Infinite scroll
|
||||
modal.addEventListener('scroll', function () {
|
||||
if (!loading && !reachedEnd && (modal.scrollTop + modal.offsetHeight > modal.scrollHeight - 80)) {
|
||||
const modalBody = modal.querySelector('.modal-body');
|
||||
|
||||
modalBody.addEventListener('scroll', function () {
|
||||
if (!loading && !reachedEnd && (modalBody.scrollTop + modalBody.clientHeight > modalBody.scrollHeight - 80)) {
|
||||
fetchProducts(false);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user