PDF Contact
EXPLORE

A/C, Electrical and Communication system

function closeModal() { // Get the modal element and hide it let modal = document.getElementById("imageModal"); modal.style.display = "none"; // Remove the event listener for keyboard navigation document.removeEventListener('keydown', handleKeyPress); } function handleKeyPress(event) { // Handle arrow key navigation switch (event.key) { case 'ArrowLeft': navigateImage(-1); // Move to the previous image break; case 'ArrowRight': navigateImage(1); // Move to the next image break; case 'Escape': closeModal(); // Close the modal on Escape key break; default: break; } } function navigateImage(direction) { let modalImg = document.getElementById("previewImage"); let currentImageIndex = findImageIndex(modalImg.src); let nextImageIndex = currentImageIndex + direction; // Get all images in the carousel let images = document.querySelectorAll('#multi-item-carousel-1 .card-img-top'); // Wrap around when reaching the first or last image if (nextImageIndex < 0) { nextImageIndex = images.length - 1; } else if (nextImageIndex >= images.length) { nextImageIndex = 0; } // Set the source of the next image in the modal modalImg.src = images[nextImageIndex].src; } function findImageIndex(src) { let images = document.querySelectorAll('#multi-item-carousel-1 .card-img-top'); for (let i = 0; i < images.length; i++) { if (images[i].src === src) { return i; } } return -1; // Image not found }