
-
AuthorPosts
-
July 15, 2025 at 11:51 am #1486794
Hi
I have a page which loads a lightbox gallery when you click on the image/icon of the image.
I have a button underneath which I want to launch the same lightbox gallery if you click on it.
I can’t see any custom url associated with the lightbox gallery.
Is there any way I can create the actioin on the button that launches the gallery?Please advise.
July 16, 2025 at 7:15 am #1486848Hey woogie07,
Thank you for the inquiry.
Have you tried using an image URL as the link for the Button element? This should trigger the lightbox and open the gallery that includes the images on the page. Let us know if this works for you.
Best regards,
IsmaelJuly 17, 2025 at 11:08 am #1486922Hi
If I put the url first image of the lightbox in, only that image loads and not the lightbox gallery.
Please advise.
Thanks
MarcusJuly 18, 2025 at 6:39 am #1486959Hi,
Thank you for the update.
This is still possible, but we need to create a custom script to trigger the gallery when the button is clicked. To start, try to edit the gallery, go to Advanced > Developer Settings, and apply “ff-gallery-1” in the Custom CSS Class field. Next, edit the button element and place “#ff-gallery-1” in the link field. After that, add this code to the functions.php file.
add_action('wp_footer', function() { ?> <script> jQuery(document).ready(function($) { $('a[href^="#ff-gallery-"]').on('click', function(e) { e.preventDefault(); var target = $(this).attr('href').replace('#', ''); $('.' + target + ' .avia-gallery-big').trigger('click'); }); }); </script> <?php });
You can do the same for the second and third gallery, just replace -1 with -2 and -3.
Best regards,
IsmaelJuly 18, 2025 at 11:17 am #1486969Hi
Thanks for that. I will try it.
Can the script go in the CSS, or can it be added to Code snippets plugin that we run on the site?
Thanks
July 18, 2025 at 7:29 pm #1486991 -
AuthorPosts
- You must be logged in to reply to this topic.