Lightbox or colorbox implementation

Hey, I am getting further with the starterkit theme, but now i would like to add lightbox functionality. Coming from a Drupal 7 approach (where you do this in GUI by adding the colorbox module and by creating the appropriate fields in your contenttype) in Kirby this is quite harder for me to accomplish. I am not so good php-coder. Maybe somebody knows where to start with providing a link to a howto ? Or is there a nice plugin with clear documentation which can do the trick ? On this forum i found information about Magnific Popup, but unfurtonately it’s too brief for me… Thanks.

colorbox and lightbox do have tutorials how to implement them in your own template

usually it’s adding the javascript file at the bottom just before body
and adding some html markup to your content:

So for example your template code would just call the pictures from the current page:

<?php $picture = $page->images()->first() ?>
  <a href="<?php echo $picture->url() ?>" data-lightbox="roadtrip">
<?php echo $picture->caption() ?></a>

@carstengrimm: To make blocks of code more readable, could you pls. enclose them within three backticks at the beginning and the end of the block in the future? Thank you. I have edited your post above; to see how it works, just click on the pencil icon.

1 Like

Thanks Carstengrimm will give this a try. I understand there is no readymade solution available (yet), but in the end it’s one of the reasons why i started with Kirby. A lightweight cms which also eagers you to learn something essential coding.

yes it’s not very difficult and very easy to adjust.