-
AuthorPosts
-
May 24, 2022 at 12:03 pm #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,
VeraMay 25, 2022 at 7:23 am #1352868Hey 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,
IsmaelMay 27, 2022 at 10:47 am #1353113Hi 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 oneBest regards,
VeraMay 29, 2022 at 11:28 pm #1353375Hi,
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,
MikeMay 30, 2022 at 9:04 am #1353430Hi Mike,
fantastic. Thank you very much for your great help.
Best regards,
VeraMay 30, 2022 at 10:07 am #1353432 -
AuthorPosts
- You must be logged in to reply to this topic.