Product | Thumbnail Slider With Zoom Effect Jquery Codepen

// DOM elements const $mainImg = $('#mainImage'); const $zoomContainer = $('#zoomContainer'); const $thumbTrack = $('#thumbTrack'); const $thumbWrapper = $('#thumbWrapper'); const prevBtn = $('#prevThumbBtn'); const nextBtn = $('#nextThumbBtn');

// Update active thumbnail UI function updateActiveThumbnail() $('.thumb-item').removeClass('active-thumb'); $('.thumb-item').eq(currentIndex).addClass('active-thumb'); // optional: scroll thumbnail into view horizontally const $activeThumb = $('.thumb-item').eq(currentIndex); if ($activeThumb.length) thumbLeft + thumbWidth > containerLeft + containerWidth) $thumbWrapper.animate( scrollLeft: thumbLeft - (containerWidth/2) + (thumbWidth/2) , 200);

/* slider track */ .thumbnail-track-wrapper overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; border-radius: 1.5rem; padding-bottom: 0.5rem; product thumbnail slider with zoom effect jquery codepen

.thumb-img width: 100%; height: 100%; object-fit: cover; display: block;

.slider-header display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; // DOM elements const $mainImg = $('#mainImage'); const

.thumb-item.active-thumb border-color: #2c5f8a; box-shadow: 0 8px 20px rgba(44,95,138,0.25); transform: scale(1.02);

/* layout grid: main zoom area + thumbnail slider */ .product-grid display: flex; flex-direction: column; gap: 2rem; const $zoomContainer = $('#zoomContainer')

.main-image width: 100%; height: 100%; object-fit: contain; transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1); transform-origin: center center; background: #fefefe; pointer-events: none; /* zoom handled by container overlay logic */

.thumbnail-track-wrapper::-webkit-scrollbar height: 6px;

/* main product card container */ .product-showcase max-width: 1280px; width: 100%; background: rgba(255,255,255,0.75); backdrop-filter: blur(2px); border-radius: 2.5rem; box-shadow: 0 25px 45px -12px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.05); padding: 2rem 2rem 2rem 2rem; transition: all 0.2s ease;