diff --git a/public/themes/dist_static/static/js/solution.js b/public/themes/dist_static/static/js/solution.js index f1fa558..34d0e16 100644 --- a/public/themes/dist_static/static/js/solution.js +++ b/public/themes/dist_static/static/js/solution.js @@ -12,10 +12,18 @@ function initCoreSwiper() { const root = document.querySelector(".sl-core"); const el = root?.querySelector(".sl-core__swiper"); if (!root || !el || !window.Swiper) return; + const slideCount = el.querySelectorAll(".swiper-wrapper > .swiper-slide").length; + // 一屏展示 3 条,不超过 3 条时隐藏切换按钮 + if (slideCount <= 3) { + root.querySelectorAll(".sl-core__head .s-arrows").forEach((node) => { + node.style.display = "none"; + }); + } new window.Swiper(el, { slidesPerView: 3, spaceBetween: 40, speed: 600, + watchOverflow: true, navigation: { prevEl: root.querySelector(".sl-core__head .s-arrows__prev"), nextEl: root.querySelector(".sl-core__head .s-arrows__next")