debugger added
This commit is contained in:
1 parent
dd65ea7b06
commit
957d749ade
1 file changed
+5
-2
+5
-2
@@ -1,14 +1,17 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const galleryContainer = document.getElementById('gallery-container');
|
const galleryContainer = document.getElementById('gallery-container');
|
||||||
|
if (!galleryContainer) {
|
||||||
|
console.error("Gallery container not found!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get filenames from HTML attribute
|
|
||||||
const files = galleryContainer.dataset.files.split(',');
|
const files = galleryContainer.dataset.files.split(',');
|
||||||
|
|
||||||
files.forEach((file, index) => {
|
files.forEach((file, index) => {
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.src = `gallery/${file.trim()}`;
|
img.src = `gallery/${file.trim()}`;
|
||||||
img.alt = `Image ${index + 1}`;
|
img.alt = `Image ${index + 1}`;
|
||||||
img.onerror = () => { img.style.display = 'none'; }; // hide broken images
|
img.onerror = () => { img.style.display = 'none'; };
|
||||||
galleryContainer.appendChild(img);
|
galleryContainer.appendChild(img);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user