Files
website/js/gallery.js
T
2025-09-16 19:30:40 +03:00

18 lines
546 B
JavaScript

document.addEventListener('DOMContentLoaded', () => {
const galleryContainer = document.getElementById('gallery-container');
if (!galleryContainer) {
console.error("Gallery container not found!");
return;
}
const files = galleryContainer.dataset.files.split(',');
files.forEach((file, index) => {
const img = document.createElement('img');
img.src = `gallery/${file.trim()}`;
img.alt = `Image ${index + 1}`;
img.onerror = () => { img.style.display = 'none'; };
galleryContainer.appendChild(img);
});
});