Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1253884

    Hi, is there a way to set a lightbox-effect to images in an accordeon?

    The four images in the first toggle ‘Grundriss’ should be enlarged in a lightbox:

    Thx!

    • This topic was modified 4 years, 1 month ago by Wulius.
    #1254033

    Hi Wulius,

    Yes, please do the following:
    1. Click the image and add a link to it, then paste the image URL (the one you want to appear in the lightbox, you can open a new tab and open Media > Library and copy the URL from there)
    2. Switch the mode from Visual to Text and you should see something like this (only for 1 image)

    <a href="http://website.com/wp-content/uploads/2020/10/image.jpg"><img class="alignnone size-medium wp-image-965" src="https://website.com/wp-content/uploads/2020/10/image-300x150.jpg" alt="" width="300" height="150" /></a>

    3. After the href add a class attribute with a value of lightbox ( class=”lightbox” ) the code should look like this:

    <a href="http://website.com/wp-content/uploads/2020/10/image.jpg" class="lightbox"><img class="alignnone size-medium wp-image-965" src="https://website.com/wp-content/uploads/2020/10/image-300x150.jpg" alt="" width="300" height="150" /></a>

    4. Repeat these steps on your other images.
    Hope it helps :)

    Best regards,
    Nikko

    #1254251

    Hi Nikko,
    thx, works perfectly. Can I also display the image-description below the image automatically?

    Thx, regards

    • This reply was modified 4 years ago by Wulius.
    #1254558

    Hi Wulius,

    I’m glad to hear that :)
    Just add a title attribute to the image, here’s how it should look like (I removed some attributes here for the sake of example)

    <a href="image_url" class="lightbox"><img src="image_url" title="Title Here" /></a>

    Best regards,
    Nikko

    #1256101

    This works fine, thx a lot.

    Regards
    Wulius

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘lightbox-effect in accordeon’ is closed to new replies.