• widgetマスター

    モデレータ
    2024年1月30日 13:48

    既存のWidgetを修正しました!

    なので入れ直していただければと思います!

    プレビュー:https://sb-draft-preview.squadbeyond.com/articles/RknfStoArheJnbxwPDw/draft?token=26968add7f826d868c1706ad0cb13e85

    既存ページの修正を行いたい場合は、Widget内の javascriptを javascript headに移動した上で、下記の複数のスライドに対応のjavascriptに入れ替えていただければと思います。

    
    
    <script>
        var sbReactionSlide = sbReactionSlide || {};
        (function(_) {
            const target = '.js-product-detail';
            _.swiper = function(el, elIndex) {
                const swiperEl = el.querySelector('.swiper');
                const navigationEl = swiperEl.closest('.product__info');
                navigationEl.classList.add(swiper-${+elIndex});
                const swiper = new Swiper(swiperEl, {
                    loop: true,
                    slidesPerView: 1,
                    spaceBetween: 15,
                    speed: 750,
                    autoplay: {
                        delay: 5000,
                        disableOnInteraction: false,
                    },
                    pagination: {
                        el: .swiper-${+elIndex} .swiper-pagination,
                        type: 'bullets',
                        clickable: true,
                    },
                    navigation: {
                        nextEl: .swiper-${+elIndex} .swiper-button-next,
                        prevEl: .swiper-${+elIndex} .swiper-button-prev,
                    },
                });
            }
            _.init = function() {
                Array.from(document.querySelectorAll(target)).forEach((el, elIndex) => {
                    if (el.classList.contains('EDITABLE')) el.classList.remove('EDITABLE');
                    _.swiper(el, elIndex);
                });
            };
        })(sbReactionSlide);
    </script>