• Resolved btetrault

    (@btetrault)


    Is it possible to trigger the lightbox via a link instead of having an image? For example, like with a size chart on a product page. There would be a “Size Chart” link or button with a link and when clicked shows a lightbox with an image of the corresponding size chart within.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Johannes Kinast

    (@goaroundagain)

    You can do this with a JavaScript function: https://github.com/feimosi/baguetteBox.js#showindex-gallery

    from what i understood and tried, you need to add the class=gallery in your html. For example <p class=”gallery”> some text that is a link </p>
    When clicked the link will open the source image, if you have of course put any, with the lightbox effect. In the example above, all text to image links inside the paragraph block will open like that.
    And if you have more than one they will open as gallery, one after the other.

    In order to avoid that, you remove the gallery class from the <div> or <p> block and add it in any of the texts that links to the image. Something like that

    <a href=”image url” class=”gallery”>text 1</a> and <a href=”image url” class=”gallery”>text 2</a>

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

The topic ‘Possible to trigger lightbox with link or button?’ is closed to new replies.