• Resolved KingBenneth

    (@kingbenneth)


    Hello again. Please can you help us with this one…

    We’d like to have a gallery of images but we’d like to have them open in a lightbox when people click on a button rather than a thumbnail. Is this possible and if so, please can you show us how do we do it?

    If you see our site http://www.candycrate.co.uk we currently have a lightbox when people click on ‘see how it works’.

    Thank you very much!

    https://ww.wp.xz.cn/plugins/easy-fancybox/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Sure! FancyBox works on links and it does not matter where it links from. It can be simple text, a thumbnail image or a button image. Like the button “see how it works” but then link it to a full size image.

    To make that first image (that opens after clicking the button image) be part of a gallery of images in FancyBox, you will need to include links to all the other images that you want to see in that gallery on that same page. These links do not have to be visible on normal view. They just need to be present in the source.

    You can add invisible links to images by using link code without any anchor text or thumbnail image in it. And if you’re not using the auto-detect and/or auto-gallery options on Settings > Media, then make sure to include matching class and rel attributes.

    Like for example:

    <a href="http://the.url.of/your/image1.jpg" class="fancybox" rel="gallery-1"><img src="http://the.url.of/your/button.png" alt="open gallery" /></a>
    <a href="http://the.url.of/your/image2.jpg" class="fancybox" rel="gallery-1"></a>
    <a href="http://the.url.of/your/image3.jpg" class="fancybox" rel="gallery-1"></a>

    Hope that helps 🙂

    Thank you! This works for me. After days of searching Your solution solution helped me out a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Open lightbox from a button’ is closed to new replies.