Spaces:
Running
Running
Update index.html
Browse files- index.html +16 -4
index.html
CHANGED
|
@@ -56,6 +56,9 @@
|
|
| 56 |
font-size: 18px;
|
| 57 |
cursor: pointer;
|
| 58 |
}
|
|
|
|
|
|
|
|
|
|
| 59 |
.main {
|
| 60 |
display: flex;
|
| 61 |
height: 100%;
|
|
@@ -111,6 +114,7 @@
|
|
| 111 |
const nextBtn = document.getElementById('next-btn');
|
| 112 |
let data = [];
|
| 113 |
let currentIndex = 0;
|
|
|
|
| 114 |
// Fetch slide configuration
|
| 115 |
async function fetchSlideConfig() {
|
| 116 |
try {
|
|
@@ -122,20 +126,28 @@
|
|
| 122 |
console.error('Error loading slide configuration:', error);
|
| 123 |
}
|
| 124 |
}
|
|
|
|
| 125 |
function loadSlide(index) {
|
| 126 |
if (data.length === 0) return;
|
| 127 |
const slide = data[index];
|
| 128 |
slideTitle.textContent = slide.id.replace('_', ' ');
|
| 129 |
slideImage.src = slide.image;
|
| 130 |
}
|
|
|
|
| 131 |
prevBtn.addEventListener('click', () => {
|
| 132 |
-
|
| 133 |
-
|
|
|
|
|
|
|
| 134 |
});
|
|
|
|
| 135 |
nextBtn.addEventListener('click', () => {
|
| 136 |
-
|
| 137 |
-
|
|
|
|
|
|
|
| 138 |
});
|
|
|
|
| 139 |
// Initialize
|
| 140 |
fetchSlideConfig();
|
| 141 |
</script>
|
|
|
|
| 56 |
font-size: 18px;
|
| 57 |
cursor: pointer;
|
| 58 |
}
|
| 59 |
+
.nav-buttons button:hover {
|
| 60 |
+
background-color: #888;
|
| 61 |
+
}
|
| 62 |
.main {
|
| 63 |
display: flex;
|
| 64 |
height: 100%;
|
|
|
|
| 114 |
const nextBtn = document.getElementById('next-btn');
|
| 115 |
let data = [];
|
| 116 |
let currentIndex = 0;
|
| 117 |
+
|
| 118 |
// Fetch slide configuration
|
| 119 |
async function fetchSlideConfig() {
|
| 120 |
try {
|
|
|
|
| 126 |
console.error('Error loading slide configuration:', error);
|
| 127 |
}
|
| 128 |
}
|
| 129 |
+
|
| 130 |
function loadSlide(index) {
|
| 131 |
if (data.length === 0) return;
|
| 132 |
const slide = data[index];
|
| 133 |
slideTitle.textContent = slide.id.replace('_', ' ');
|
| 134 |
slideImage.src = slide.image;
|
| 135 |
}
|
| 136 |
+
|
| 137 |
prevBtn.addEventListener('click', () => {
|
| 138 |
+
if (data.length > 0) {
|
| 139 |
+
currentIndex = (currentIndex - 1 + data.length) % data.length;
|
| 140 |
+
loadSlide(currentIndex);
|
| 141 |
+
}
|
| 142 |
});
|
| 143 |
+
|
| 144 |
nextBtn.addEventListener('click', () => {
|
| 145 |
+
if (data.length > 0) {
|
| 146 |
+
currentIndex = (currentIndex + 1) % data.length;
|
| 147 |
+
loadSlide(currentIndex);
|
| 148 |
+
}
|
| 149 |
});
|
| 150 |
+
|
| 151 |
// Initialize
|
| 152 |
fetchSlideConfig();
|
| 153 |
</script>
|