Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Lightbox for 'first' image

Started by Muut Archive 11 years ago · 2 replies · 271 views
11 years ago

Hello,

I have installed the feather light plugin and it's working fine on my markdown images.

Yet, I'm using text.html.twig of antimatter theme which includes a header image as follows:

{% set image = page.media.images|first %}
{% if image %}
{{ image.cropResize(400,400).html('','','align-'~page.header.image_align) >}}
{% endif %}

This image displays correctly, but it hasn't the lightbox effect on click. Should I edit the .html('','',...) part so as to insert a rel="lightbox" as well as the href="path/to/the/image"? How could I do that?

Thank you,

Karl3i

11 years ago

NO simply change it to this:

TWIG
{{ image.lightbox().cropResize(400,400).html('','','align-'~page.header.i mage_align) }}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1341 9 years ago
Archive · by Muut Archive, 9 years ago
2 928 9 years ago
Archive · by Muut Archive, 9 years ago
2 4057 9 years ago
Archive · by Muut Archive, 9 years ago
1 2942 9 years ago
Archive · by Muut Archive, 9 years ago
3 1115 9 years ago