JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
   <head>
      <title>Home</title>

      <link rel="stylesheet" href="../CSS/style.css" />
      <link
         rel="stylesheet"
         href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
      />

      <script src="../SCRIPT/common.js"></script>
      <script src="../SCRIPT/magnify.js"></script>
      <script src="../SCRIPT/popup.js"></script>
   </head>
   <body>
      <header>
         <h1></h1>
         <nav>
            <a href="index.html">Home</a>
            <a href="projects.html">Blog</a>
            <a href="about.html">About</a>
            <a href="contact.html">Contact</a>
         </nav>
      </header>
      <main>
         <div class="project-container">
            <div class="image-container">
               <img
                  class="image"
                  src="../images/gallery/image1/img1-1.jpg"
                  id="main-image1"
                  index="0"
                  alt="Oops :("
               />
               <img
                  class="image"
                  src="../images/gallery/image2/img2-1.jpg"
                  id="main-image2"
                  index="1"
                  alt="Oops :("
               />
               <img
                  class="image"
                  src="../images/gallery/image3/img3-1.jpg"
                  id="main-image3"
                  index="2"
                  alt="Oops :("
               />
               <img
                  class="image"
                  src="../images/gallery/image4/img4-1.jpg"
                  id="main-image4"
                  index="3"
                  alt="Oops :("
               />
               <img
                  class="image"
                  src="../images/gallery/image5/img5-1.jpg"
                  id="main-image5"
                  index="4"
                  alt="Oops :("
               />
               <img
                  class="image"
                 ...

CSS

* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
}

.no-scroll {
   overflow: hidden;
}

.footer {
   bottom: 0;
   z-index: 10;
}

/* Overall Project Styles */
.project-container {
   position: relative;
   min-height: 100vh;
   background: #ddd;
}

/* Container for home page images */
.image-container {
   display: flex;
   flex-wrap: wrap;
   gap: 15px;
   justify-content: center;
   padding: 10px;
}

/* Home Page Image Styles */
.image {
   height: 250px;
   width: 350px;
   box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
   overflow: hidden;
   cursor: pointer;
}

/* Image Styles */
.image img {
   height: 100%;
   width: 100%;
   object-fit: cover;
   transition: 0.2s linear;
}

/* Hover Effect */
.image:hover img {
   transform: scale(1.1);
}

/* Prevent text selection */
.noselect {
   user-select: none;
   -webkit-user-drag: none;
}

/* Modal Overlay */
.modal-overlay {
   display: none;
   position: fixed;
   align-items: center;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0, 0, 0, 0.8);
   z-index: 1000;
   overflow: hidden;
}

/* Close Button */
.close-btn {
   position: absolute;
   top: 10px;
   right: 10px;
   background: #333;
   color: white;
   border: none;
   border-radius: 50%;
   width: 30px;
   height: 30px;
   cursor: pointer;
   font-size: 18px;
   display: flex;
   align-items: center;
   justify-content: center;
   z-index: 1002;
}

.close-button:hover {
   background: #555;
}

/* Navigation Arrows */
.slide-control {
   position: absolute;
   top: 50%;
   background: rgba(0, 0, 0, 0.5);
   color: white;
   border: none;
   border-radius: 50%;
   width: 40px;
   height: 40px;
   cursor: pointer;
   font-size: 24px;
   display: flex;
   align-items: center;
   justify-content: center;
   transform: translateY(-50%);
   z-index: 1002;
}

.slide-control:hover {
   background: rgba(0, 0, 0, 0.7);
}

.prev-btn {
   left: 10px;
}

.next-btn {
   right: 10px;
}

/* Contains All thumbnails...

JavaScript

<script> 
//popup.js

// Load DOM before executing
document.addEventListener('DOMContentLoaded', () => {
   const numFolders = 11;
   const numImagesPerFolder = 10;

   const blockSize = 10; // Number of elements per sub-array
   const subObject = {}; // Object to handle image sub-arrays

   let slideIndex = 0; // Current Slide

   let prevSrc = ''; // Previous Image Source

   const zoom = 1;

   // Init functions
   openModal();
   modalNav();

   // Generate Image Paths and load images initially for performance
   const popupImages = generateImagePaths(numFolders, numImagesPerFolder);

   // Function for generating image paths
   function generateImagePaths(numFolders, numImagesPerFolder) {
      const images = [];

      const altArray = [
         // Temp alt array
         'image 1',
         'image 2',
         'image 3',
         'image 4',
         'image 5',
         'image 6',
         'image 7',
         'image 8',
         'image 9',
         'image 10',
         'image 11',
      ];

      // Generate image paths
      for (let i = 1; i <= numFolders; i++) {
         for (let j = 1; j <= numImagesPerFolder; j++) {
            const filepath = `../images/gallery/image${i}/img${i}-${j}.jpg`;
            images.push(filepath);
         }
      }

      // Divide images into sub-arrays for loading
      for (let i = 0; i < Math.ceil(images.length / blockSize); i++) {
         subObject[i] = images.slice(i * blockSize, (i + 1) * blockSize);
      }

      return { subObject, altArray };
   }

   // Checks if image exists at url
   function imageExists(url, callback) {
      const img = new Image();
      img.onload = () => callback(true); // Loaded successfully
      img.onerror = () => callback(false); // Load failed
      img.src = url;
   }

   // Loads images into specified container
   function loadThumbs(subObject, altArray, slideIndex, containerId) {
      const container = document.getElementById(containerId); // Get container element
      const...