document.addEventListener('DOMContentLoaded', function () { const splides = []; document.querySelectorAll('.splide').forEach((el) => { let options; if (el.classList.contains('inr02')) { options = { type: 'fade', rewind: true, autoplay: true, interval: 5000, arrows: true, pagination: true, speed: 1000, pauseOnHover: false, }; } else if (el.classList.contains('inr01')) { options = { type: 'loop', rewind: true, arrows: true, pagination: true, }; } const instance = new Splide(el, options).mount(); splides.push(instance); }); // 外部アンカーにイベントを設定 document.querySelectorAll('a').forEach(anchor => { anchor.addEventListener('click', function (e) { // 必要ならページ遷移を防ぐ // e.preventDefault(); // すべてのSplideをリセット splides.forEach(s => s.go(0)); }); }); });