// 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)');
.thumb-item flex: 0 0 auto; width: 85px; height: 85px; border-radius: 1rem; overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
/* Lens effect for classic zoom (optional but modern: we use GSAP scaling on mousemove) */ .zoom-lens display: none;
<script> // ---------- PRODUCT DATA (High-res images + thumbnails) ---------- // We'll use a set of curated product-style images from picsum + unsplash style but high quality. // For demo, realistic product variations: watch, bag, sneakers, camera etc. const galleryItems = [ large: "https://picsum.photos/id/20/1200/900", // classic coffee & macbook thumb: "https://picsum.photos/id/20/150/150", alt: "Premium workspace" , large: "https://picsum.photos/id/26/1200/900", // venice water thumb: "https://picsum.photos/id/26/150/150", alt: "Venice inspired" , large: "https://picsum.photos/id/30/1200/900", // coffee beans thumb: "https://picsum.photos/id/30/150/150", alt: "Artisan coffee" , large: "https://picsum.photos/id/42/1200/900", // piano thumb: "https://picsum.photos/id/42/150/150", alt: "Grand piano" , large: "https://picsum.photos/id/52/1200/900", // canyon thumb: "https://picsum.photos/id/52/150/150", alt: "Desert canyon" , large: "https://picsum.photos/id/96/1200/900", // mountain thumb: "https://picsum.photos/id/96/150/150", alt: "Alpine vista" ];