Product Thumbnail Slider With Zoom Effect Jquery Codepen May 2026

.thumbnail-track display: flex; gap: 1rem; padding: 0.2rem 0.2rem;

// Set main image and reset zoom function setActiveImage(index) if (index === currentIndex) return; currentIndex = index; const newLargeSrc = galleryItems[currentIndex].large; // Reset zoom before changing image (avoid weird transforms) resetZoomWithGSAP(); // Fade transition effect gsap.to($mainImg[0], duration: 0.15, opacity: 0, onComplete: () => $mainImg.attr('src', newLargeSrc); $mainImg.attr('alt', galleryItems[currentIndex].alt); gsap.to($mainImg[0], duration: 0.2, opacity: 1 ); ); updateActiveThumbnail(); // also reset any ongoing zoom flag currentZoomScale = 1; $mainImg.css('transform', 'scale(1)');

.thumbnail-track-wrapper::-webkit-scrollbar-track background: #e2e8f0; border-radius: 10px; product thumbnail slider with zoom effect jquery codepen

.nav-btn:hover background: #1e2f4b; color: white; transform: scale(0.96);

// Current active index let currentIndex = 0; let currentZoomScale = 1; let isZooming = false; let zoomTween = null; // GSAP tween reference .thumbnail-track display: flex

.slider-header display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;

/* layout grid: main zoom area + thumbnail slider */ .product-grid display: flex; flex-direction: column; gap: 2rem; padding: 0.2rem 0.2rem

/* Thumbnail slider area */ .slider-section margin-top: 0.5rem;