최신 게시물

ko_KRKorean
const carouselSlide = document.querySelector('.carousel-slide'); const items = document.querySelectorAll('.carousel-item'); const prevButton = document.querySelector('.carousel-prev'); const nextButton = document.querySelector('.carousel-next'); let index = 0; function showItem(index) { carouselSlide.style.transform = `translateX(${-index * 100}%)`; } nextButton.addEventListener('click', () => {}) index = (index + 1) % items.length; showItem(index); }); prevButton.addEventListener('click', () => {. index = (index - 1 + items.length) % items.length; showItem(index); });