1 bình luận về “Hello world!

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

(function () { function initializeProgress(slider) { if ( slider.dataset.progressReady || typeof Flickity === 'undefined' ) return; const flickity = Flickity.data(slider); if (!flickity) return; slider.dataset.progressReady = 'true'; const progress = document.createElement('div'); const bar = document.createElement('span'); progress.className = 'product-slider-progress'; bar.className = 'product-slider-progress-bar'; progress.appendChild(bar); slider.insertAdjacentElement('afterend', progress); function updateProgress() { const totalPages = Math.max(flickity.slides.length, 1); const currentPage = flickity.selectedIndex; bar.style.width = (100 / totalPages) + '%'; bar.style.transform = 'translateX(' + (currentPage * 100) + '%)'; } flickity.on('select', updateProgress); flickity.on('resize', updateProgress); updateProgress(); } function findSliders() { document .querySelectorAll('.section-product .row-slider.flickity-enabled') .forEach(initializeProgress); } document.addEventListener('DOMContentLoaded', function () { findSliders(); /* Chờ Flatsome và sản phẩm trong tab tải xong */ setTimeout(findSliders, 500); setTimeout(findSliders, 1500); document.addEventListener('click', function (event) { if (event.target.closest('.section-product .tab a')) { setTimeout(findSliders, 500); } }); new MutationObserver(findSliders).observe(document.body, { childList: true, subtree: true }); }); })();