ahmet müzesi açıldı
This commit is contained in:
1 parent
2d6a6be925
commit
000d310baf
3 files changed
+23
-15
No files matched your search
BIN
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
@@ -15,6 +15,7 @@
|
||||
<a href="index.html" id="home-btn"></a>
|
||||
<button id="about-btn">About This Website</button>
|
||||
<button id="gallery-btn">Gallery</button>
|
||||
<button id="ahmet-btn">Ahmet Museum</button>
|
||||
</div>
|
||||
|
||||
<section id="about" class="tab-content">
|
||||
@@ -28,6 +29,11 @@
|
||||
<div id="gallery-container" class="gallery-grid"></div>
|
||||
</section>
|
||||
|
||||
<section id="ahmet" class="tab-content">
|
||||
<div id="ahmet-container" class="gallery-grid">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="js/gallery.js" defer></script>
|
||||
<script src="js/hideBroken.js" defer></script>
|
||||
<script src="js/tabs.js" defer></script>
|
||||
|
||||
+17
-15
@@ -1,27 +1,29 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const galleryContainer = document.getElementById('gallery-container');
|
||||
const totalImages = 50; // number of images you want to load
|
||||
// Function to load images into a specific container from a specific folder
|
||||
const loadGallery = (containerId, folderName, totalImages) => {
|
||||
const container = document.getElementById(containerId);
|
||||
if (!container) return;
|
||||
|
||||
for (let i = 1; i <= totalImages; i++) {
|
||||
const img = document.createElement('img');
|
||||
img.alt = `Image ${i}`;
|
||||
img.alt = `${folderName} Image ${i}`;
|
||||
|
||||
// Try jpg first
|
||||
img.src = `gallery/${i}.jpg`;
|
||||
|
||||
// fallback to png
|
||||
// Try loading jpg -> png -> gif
|
||||
img.src = `${folderName}/${i}.jpg`;
|
||||
img.onerror = () => {
|
||||
img.src = `gallery/${i}.png`;
|
||||
|
||||
// fallback to gif
|
||||
img.src = `${folderName}/${i}.png`;
|
||||
img.onerror = () => {
|
||||
img.src = `gallery/${i}.gif`;
|
||||
|
||||
// hide if all fail
|
||||
img.src = `${folderName}/${i}.gif`;
|
||||
img.onerror = () => { img.style.display = 'none'; };
|
||||
};
|
||||
};
|
||||
|
||||
galleryContainer.appendChild(img);
|
||||
container.appendChild(img);
|
||||
}
|
||||
};
|
||||
|
||||
// Load your original Gallery
|
||||
loadGallery('gallery-container', 'gallery', 50);
|
||||
|
||||
// Load your new Ahmet Museum (adjust the number 20 to however many photos you have)
|
||||
loadGallery('ahmet-container', 'ahmet', 20);
|
||||
});
|
||||
Reference in new issue
Block a user