Spaces:
Running
Running
Update index.html
Browse files- index.html +30 -29
index.html
CHANGED
@@ -303,35 +303,36 @@
|
|
303 |
</div>
|
304 |
|
305 |
<script>
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
|
|
335 |
</script>
|
336 |
</body>
|
337 |
</html>
|
|
|
303 |
</div>
|
304 |
|
305 |
<script>
|
306 |
+
// Get the modal
|
307 |
+
var modal = document.getElementById("imageModal");
|
308 |
+
|
309 |
+
// Get the image and insert it inside the modal
|
310 |
+
var zoomableImages = document.querySelectorAll(".chart img");
|
311 |
+
var modalImg = document.getElementById("zoomedImage");
|
312 |
+
|
313 |
+
// Add click event to all zoomable images
|
314 |
+
zoomableImages.forEach(function(image) {
|
315 |
+
image.onclick = function() {
|
316 |
+
modal.style.display = "flex";
|
317 |
+
modalImg.src = this.src;
|
318 |
+
};
|
319 |
+
});
|
320 |
+
|
321 |
+
// Get the <span> element that closes the modal
|
322 |
+
var span = document.getElementsByClassName("close")[0];
|
323 |
+
|
324 |
+
// When the user clicks on <span> (x), close the modal
|
325 |
+
span.onclick = function() {
|
326 |
+
modal.style.display = "none";
|
327 |
+
};
|
328 |
+
|
329 |
+
// Close the modal when clicking outside the image
|
330 |
+
modal.onclick = function(event) {
|
331 |
+
if (event.target === modal) {
|
332 |
+
modal.style.display = "none";
|
333 |
+
}
|
334 |
+
};
|
335 |
+
|
336 |
</script>
|
337 |
</body>
|
338 |
</html>
|