Articles in Process

The articles are processing currently...

document.addEventListener("DOMContentLoaded", function() { const closeBtn = document.getElementById("close-btn"); const smallImages = document.querySelectorAll(".small-image"); const showImagePopup = document.getElementById("show_image_popup"); const largeImage = document.getElementById("large-image"); function handlePopupDisplay() { if (window.innerWidth <= 568) { showImagePopup.style.display = 'none'; smallImages.forEach(image => image.removeEventListener("click", imageClickHandler)); document.removeEventListener("click", documentClickHandler); closeBtn.removeEventListener("click", closeBtnClickHandler); } else { smallImages.forEach(image => image.addEventListener("click", imageClickHandler)); document.addEventListener("click", documentClickHandler); closeBtn.addEventListener("click", closeBtnClickHandler); } } function imageClickHandler(event) { event.stopPropagation(); smallImages.forEach(img => img.classList.remove('active')); this.classList.add('active'); const imagePath = this.getAttribute('src'); showImagePopup.style.display = 'block'; largeImage.setAttribute('src', imagePath); } function documentClickHandler(event) { if (event.target.closest("#show_image_popup") === null) { smallImages.forEach(image => image.classList.remove('active')); showImagePopup.style.display = 'none'; } } function closeBtnClickHandler() { smallImages.forEach(image => image.classList.remove('active')); showImagePopup.style.display = 'none'; } // Call the function initially handlePopupDisplay(); // Add event listener for window resize window.addEventListener("resize", handlePopupDisplay); });