带有共享控制器的滑动器,使画廊的拇指滑动过多

时间:2018-09-13 16:44:03

标签: swiper

我尝试用thumbs gallery实现Swiper,但似乎如示例所示那样不起作用。查看gif-有人知道吗?

swiper with thumbs gif

if (el.hasAttribute('data-item-gallery')) {
                swiperOptions.slidesPerView = 1;
                swiperOptions.centeredSlides = true;
                swiperOptions.slideToClickedSlide = true;
                delete swiperOptions.breakpoints;
                delete swiperOptions.spaceBetween;
            }

            setTimeout(() => {
                swiperOptions.navigation.nextEl = `.${currentContainerInstanceClass} .swiper-button-next`;
                swiperOptions.navigation.prevEl = `.${currentContainerInstanceClass} .swiper-button-prev`;
                const swiper = new Swiper(`.${instanceClass}`, swiperOptions);

                if (el.hasAttribute('data-item-gallery')) {
                    const galleryThumbs = new Swiper('.gallery-thumbs', {
                        centeredSlides: false,
                        slidesPerView: 'auto',
                        touchRatio: 0.2,
                        slideToClickedSlide: true
                    });
                    swiper.controller.control = galleryThumbs;
                    galleryThumbs.controller.control = swiper;
                }
            });

0 个答案:

没有答案