//slickスライダー $(function () { $(".regular").slick({ arrows: true, autoplay: false, variableWidth: true, draggable: false, adaptiveHeight: true, centerMode: true, centerPadding: "15%", dots: true, dotsClass: "slide-dots", prevArrow: '', nextArrow: '', }); }); document.addEventListener("DOMContentLoaded", function () { const tabButtons = document.querySelectorAll(".tab-button"); const tabContents = document.querySelectorAll(".tab-content"); const marginTop = 100; // スクロール時に上部に確保する余白(ピクセル) tabButtons.forEach((button) => { button.addEventListener("click", function () { // アクティブなタブとコンテンツを非アクティブにする tabButtons.forEach((btn) => btn.classList.remove("active")); tabContents.forEach((content) => content.classList.remove("active")); const marginTop = 100; // スクロール時に上部に確保する余白(ピクセル) // クリックされたボタンをアクティブにし、対応するコンテンツを表示 button.classList.add("active"); const tabId = button.getAttribute("data-tab"); const targetContent = document.getElementById(tabId); targetContent.classList.add("active"); // スクロール設定 setTimeout(() => { const slider = targetContent.querySelector(".regular"); if (slider) { $(slider).slick("refresh"); } targetContent.scrollIntoView({ behavior: "smooth" }); }, 100); // 0.1秒の遅延 }); }); });