Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #342277

    Hi,
    Is there a way for Enfold Lightbox to see all he images associated with the portfolio item, or just the images that are in the advanced layout editor?
    At the moment they cycle through the images within a Colour Section only.
    Also, I’d like to add images from a Full Width Easy Slider to the cycle, but this is less important (I’m using a large image at the top, but it’s a better solution than just Image item).

    Thanks for your help.

    #343411

    Hey zohar!

    Thank you for using Enfold.

    Please add this at the very bottom of functions.php to grouped all linked images inside a lightbox:

    function add_custom_script(){
    ?>
    <script>
    (function($){
    $(window).load(function() {
    $('.single-portfolio').magnificPopup({
    	delegate: 'a',
    	type: 'image',
    	mainClass: 'avia-popup mfp-zoom-in',
    	gallery: {
    		tPrev:		'',
    		tNext:		'',
    		tCounter:	'%curr% / %total%',
    		enabled:	true,
    		preload:	[1,1] // Will preload 1 - before current, and 1 after the current image
    	},
    	callbacks: {
    		imageLoadComplete: function() 
    		{	
    			var self = this;
    			setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
    		}
    	}
    }); 
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    I haven’t tested if the slider images will be included on the lightbox.

    Best regards,
    Ismael

    #343435

    Hi Ismael, Thanks for your reply.
    This solution works… partly.

    It now loads more images than I have actually associated to the post. 8 are uploaded but I see 80 in the list (15/80 for instance) and most of them show the message “the image could not be loaded”.

    Finding it difficult to understand how it knows which images to use…

    #343439

    I just noticed that navigation also now activates the lightbox (I think it’s anything with the ‘a’)

    #343443

    Ok, found a solution – changing delegate: 'a', to delegate: 'a.avia_image', was loading only the images associated with a lightbox. While not being all the images associated with the page, it’s a good enough solution for now.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Lightbox on all photos in portfolio item’ is closed to new replies.