Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1352747

    Hi,
    with your help I created a lightbox gallery that is triggered by a textlink. #post-1350182.
    The problem:
    The lightbox does not start with the first image of the gallery order. This seems to appear when the amount of images exceeds 6 items.

    Best regards,
    Vera

    #1352868

    Hey Vera,

    Thank you for the inquiry.

    Where can we see this issue? Please post the site details in the private field so that we can check the gallery. A screenshot uploaded to imgur, savvyify or dropbox will also help. Thanks!

    Best regards,
    Ismael

    #1353113

    Hi Ismael,

    the site details are in the private field.
    The screenshots for the gallery triggered by the left (+) starts for example with image 11/15.Lightbox gallery does not start with image number one

    Best regards,
    Vera

    #1353375

    Hi,
    Thank you for your patience and for the link to your site, I found that the reason this was happening is because the script that opens the hidden gallery targets the thumbnail class first_thumb but this class is added to the first thumbnail in each row and by default 5 columns are used for each row, so since you have 15 images in the gallery several will have this class and the default action of JQuery is to land on the last one.
    One way to correct this is to change the number of columns used for the thumbnails, but the largest option is 12 so this doesn’t help you.
    The other option is to change your script to target the :first thumbnail with the class first_thumb which is what I did for you, your script is now like this:

    function text_link_to_gallery_lightbox() {
    ?>
    <script type="text/javascript">
    (function($) {
        $(document).on('click', '.text_to_lightbox a', function(event) { 
            event.preventDefault(); 
            var linkTarget = $(this).attr('href');
            $(linkTarget).find("a.first_thumb:first").click(); 
        });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'text_link_to_gallery_lightbox');

    Now the lightbox does starts with the first image of the gallery order.

    Best regards,
    Mike

    #1353430

    Hi Mike,

    fantastic. Thank you very much for your great help.

    Best regards,
    Vera

    #1353432

    Hi,

    Great, I’m glad that Mike could help you out. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.