79080268

Date: 2024-10-12 05:57:57
Score: 1.5
Natty:
Report link

已经过了三年了,希望你已经解决了这个问题。

我刚刚研究出一个解决方案:

    $('#gallery-1').on('click', 'a', function(event) {
        
        let index = $(this).closest('.gallery-item').index('#gallery-1 .gallery-item');

        setTimeout(()=>{
            let galleryLightbox = $(`#elementor-lightbox-slideshow-${$(this).data('elementor-lightbox-slideshow')}`);
            let swiper_target = galleryLightbox.find('.swiper');
            if(swiper_target.length) {
                let swiperInstance = swiper_target.data('swiper');
                swiperInstance.loopDestroy();
                swiperInstance.params.loop = false;
                swiperInstance.update();
                swiperInstance.slideTo(index, 0)
            }
            

        }, 500);
        
    });

通过监听弹出图片,并使用 JS 动态修改 Swiper,请将 #gallery-1 替换为你的 Gallery ID。

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • No latin characters (1.5):
  • Low reputation (1):
Posted by: 徐先生