Support

Account

Home Forums General Issues Photoswipe lightbox does't detect image field (solved) Reply To: Photoswipe lightbox does't detect image field (solved)

  • Hi, I know this is older thread, but I ran into same problem and fixed it in a similar way @jeremynative did.

    Addind a tag with class “fancybox-img” and actual url of full size img as href worked for me.

    I was basically doing image swiper and in a loop when I was generating images I just added a tag mentioned above.

    Here is my code (notice the a tag i added on img):

    
            <div class="swiper-container gallery-swiper">
    			<div class="swiper-wrapper">       
                    <?php 
                        $gallery = get_field("galerie");
                        if ($gallery)
                            foreach ( $gallery as $img ){
                                ?>
                                <div class="swiper-slide">
                                    <a class="fancybox-img" href="<?php echo esc_url($img['url']);?>">
                                        <img src="<?php echo esc_url($img['sizes']['homepage-nav']);?>" link=file alt="<?php esc_attr($img['alt']);?>"/>
                                    </a>
                                </div>
                                <?php
                            }
                    ?>
    			</div>
    
                <div class="swiper-button-next"></div>
                <div class="swiper-button-prev"></div>	
    		</div>  

    Hope tihs will be helpfull to someone.