Shop from Top Fashion Brands

Shop featured brands & stores

JavaScript Carousel .carousel-container { position: relative; width: 100%; overflow: hidden; margin: auto; } .carousel-track { display: flex; transition: transform 0.5s ease-in-out; } .carousel-item { min-width: 16.66%; box-sizing: border-box; padding: 10px; } .carousel-item img { width: 100%; display: block; } .carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0, 0, 0, 0.5); color: white; border: none; cursor: pointer; padding: 10px; } .carousel-btn.prev { left: 10px; } .carousel-btn.next { right: 10px; } .carousel-item img { height: auto; width: 145px; } const track = document.querySelector('.carousel-track'); const items = Array.from(track.children); const prevButton = document.querySelector('.carousel-btn.prev'); const nextButton = document.querySelector('.carousel-btn.next'); const itemWidth = items[0].getBoundingClientRect().width; let currentSlide = 0; let isDragging = false; let startPos = 0; let currentTranslate = 0; let prevTranslate = 0; let animationID; const setPositionByIndex = () => { currentTranslate = currentSlide * -itemWidth; prevTranslate = currentTranslate; track.style.transform = `translateX(${currentTranslate}px)`; }; const autoPlay = () => { nextSlide(); setTimeout(autoPlay, 3000); // Change slides every 3 seconds }; const nextSlide = () => { if (currentSlide { if (currentSlide > 0) { currentSlide--; } else { currentSlide = items.length - 6; } setPositionByIndex(); }; const animation = () => { track.style.transform = `translateX(${currentTranslate}px)`; if (isDragging) requestAnimationFrame(animation); }; const touchStart = (index) => (event) => { currentSlide = index; startPos = getPositionX(event); isDragging = true; animationID = requestAnimationFrame(animation); track.style.transition = 'none'; }; const touchEnd = () => { isDragging = false; cancelAnimationFrame(animationID); const movedBy = currentTranslate - prevTranslate; if (movedBy < -100 && currentSlide 100 && currentSlide > 0) currentSlide--; setPositionByIndex(); track.style.transition = 'transform 0.5s ease-in-out'; }; const touchMove = (event) => { if (isDragging) { const currentPosition = getPositionX(event); currentTranslate = prevTranslate + currentPosition - startPos; } }; const getPositionX = (event) => { return event.type.includes('mouse') ? event.pageX : event.touches[0].clientX; }; items.forEach((item, index) => { const image = item.querySelector('img'); image.addEventListener('dragstart', (e) => e.preventDefault()); // Touch events image.addEventListener('touchstart', touchStart(index)); image.addEventListener('touchend', touchEnd); image.addEventListener('touchmove', touchMove); // Mouse events image.addEventListener('mousedown', touchStart(index)); image.addEventListener('mouseup', touchEnd); image.addEventListener('mouseleave', touchEnd); image.addEventListener('mousemove', touchMove); }); nextButton.addEventListener('click', nextSlide); prevButton.addEventListener('click', prevSlide); setPositionByIndex(); setTimeout(autoPlay, 3000); // Start autoplay after 3 seconds

Luxury Finds

Nike

Adidas
New Balance

Dlor Solar

MOST POPULAR FOR WOMEN

MOST POPULAR FOR WOMEN SHOES

ALL CATEGORY

ELECTRONIC CATEGORY

MOST POPULAR FOR WOMEN BAGS

‘Dorieo’ Tote Bag

Original price was: $85.00.Current price is: $59.00.

Learn how to get a 30% discount on all products.

Follow us on:

MOST POPULAR

MOST POPULAR FOR BEAUTY

MOST POPULAR FOR WOMEN JEWELLERY

MOST POPULAR FOR ELECTRONIC

0 Wishlist
0 Compare