This commit is contained in:
esefxdz committed 2025-10-03 11:32:54 +03:00
1 parent f4559447b7
commit 9c248bea06
2 files changed
+58 -27

No files matched your search

+6 -11
View File
@@ -1,17 +1,12 @@
document.addEventListener('DOMContentLoaded', () => {
const galleryContainer = document.getElementById('gallery-container');
if (!galleryContainer) {
console.error("Gallery container not found!");
return;
}
const totalImages = 50; // number of images you want to load
const files = galleryContainer.dataset.files.split(',');
files.forEach((file, index) => {
for (let i = 1; i <= totalImages; i++) {
const img = document.createElement('img');
img.src = `gallery/${file.trim()}`;
img.alt = `Image ${index + 1}`;
img.onerror = () => { img.style.display = 'none'; };
img.src = `gallery/${i}.jpg`; // assuming .jpg extension, change if needed
img.alt = `Image ${i}`;
img.onerror = () => { img.style.display = 'none'; }; // hide broken images
galleryContainer.appendChild(img);
});
}
});