• Suika

    (@suikalum)


    Hello, is there a way I can trigger to open the lightbox using another button instead of clicking on the gallery images?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    Not via plugin options, but some workarounds are possible. Answers to the following might help:

    1. Are you defining galleries in posts or pages? If you have them in pages this might be easy, but if you have them in posts, read on.
    2. If you have galleries on posts, does your website display full posts on the category / tag / date / blog pages, or does it display excerpts? If you are not displaying full posts, this might be easy, but if not, it is harder.
    3. If you are displaying galleries in pages, or if you are displaying them on posts but are not displaying full posts on the category / tag / date / blog pages, how many galleries do you have per page or post? If you have one gallery or a fixed number of galleries per post / page, I believe what you are asking for is doable. If you provide me with a URL to your site I can help you out.

    Basically you may be able to create a link that has the same markup as the first image in a gallery, but has a button or text instead of the thumbnail. Send across your URL and I will take a look.

    Thread Starter Suika

    (@suikalum)

    I am defining the gallery in posts, I get the album ID from a custom field in the custom post type. It’s a custom template for the single page, and there’s only one gallery in it.

    This is what I tried so far from your suggestion – I just copied the outer div and anchor of the first image on the gallery and then replaced the img with a text and added some classes to make it look like a button that says “Test Launch Gallery” and I get that it only gets the first image because that’s what’s on the href of the link but I’d like to point it to the existing gallery itself.

    You can check here. Many thanks!

    Plugin Author Sayontan Sinha

    (@sayontan)

    Looks like this approach will not work for Magnific – Magnific groups based on the parent container, and in this case your button is outside the parent container that contains the other photos.

    You could change your lightbox to Swipebox and try this (you will need to change your markup for this – the a tag changes).

    Note that even if you get this to run, the first image will show up twice in the lightbox, first via the button, and second via the gallery.

    There could be other alternatives via JavaScript functions attached to the button, but I am not sure if the pain is worth the benefit.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Trigger lightbox by another button’ is closed to new replies.