Spaces:
Running
Running
Update index.html
Browse files- index.html +40 -27
index.html
CHANGED
|
@@ -1,40 +1,53 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<
|
| 6 |
-
<title>Spider-Man Image Gallery</title>
|
| 7 |
<style>
|
| 8 |
-
/*
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
padding: 20px;
|
| 14 |
}
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
display: flex;
|
| 19 |
-
flex-wrap: wrap;
|
| 20 |
-
justify-content: center;
|
| 21 |
-
gap: 20px;
|
| 22 |
-
padding: 20px;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
/* Style for individual images */
|
| 26 |
-
#image-gallery img {
|
| 27 |
-
max-width: 100%;
|
| 28 |
height: auto;
|
| 29 |
-
border: 1px solid #ccc;
|
| 30 |
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
| 31 |
}
|
| 32 |
</style>
|
| 33 |
</head>
|
| 34 |
<body>
|
| 35 |
-
<h1>Spider-Man
|
| 36 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
</body>
|
| 40 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Spider-Man Gallery</title>
|
|
|
|
| 6 |
<style>
|
| 7 |
+
/* Basic CSS for gallery layout */
|
| 8 |
+
.gallery {
|
| 9 |
+
display: grid;
|
| 10 |
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
| 11 |
+
gap: 10px;
|
|
|
|
| 12 |
}
|
| 13 |
+
|
| 14 |
+
.gallery img {
|
| 15 |
+
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
height: auto;
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
+
<h1>Spider-Man Gallery</h1>
|
| 22 |
+
<div class="gallery">
|
| 23 |
+
<!-- JavaScript will populate this section with images from the folder -->
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<script>
|
| 27 |
+
// JavaScript code to load images from the folder
|
| 28 |
+
const galleryContainer = document.querySelector('.gallery');
|
| 29 |
+
|
| 30 |
+
// Replace 'spidey_images/' with the actual path to your image folder
|
| 31 |
+
const folderPath = 'spidey/';
|
| 32 |
+
|
| 33 |
+
// Fetch a list of image files from the server
|
| 34 |
+
fetch(`${folderPath}`)
|
| 35 |
+
.then(response => response.text())
|
| 36 |
+
.then(text => {
|
| 37 |
+
// Split the response into lines, assuming each line is a file name
|
| 38 |
+
const imageFileNames = text.split('\n').filter(Boolean);
|
| 39 |
|
| 40 |
+
// Loop through the file names and create img elements
|
| 41 |
+
imageFileNames.forEach(fileName => {
|
| 42 |
+
const img = document.createElement('img');
|
| 43 |
+
img.src = `${folderPath}${fileName}`;
|
| 44 |
+
img.alt = fileName;
|
| 45 |
+
galleryContainer.appendChild(img);
|
| 46 |
+
});
|
| 47 |
+
})
|
| 48 |
+
.catch(error => {
|
| 49 |
+
console.error('Error loading images:', error);
|
| 50 |
+
});
|
| 51 |
+
</script>
|
| 52 |
</body>
|
| 53 |
</html>
|