FlameF0X commited on
Commit
6383139
·
verified ·
1 Parent(s): f19af55

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +30 -29
index.html CHANGED
@@ -303,35 +303,36 @@
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.getElementsByClassName("chart").getElementsByTagName("img");
311
- var modalImg = document.getElementById("zoomedImage");
312
-
313
- // Add click event to all zoomable images
314
- for (var i = 0; i < zoomableImages.length; i++) {
315
- zoomableImages[i].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
  </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>