make appearance of lightbox configurable

This commit is contained in:
2024-02-05 14:04:31 +01:00
parent dc64b7bda1
commit 0a778ee8e9
6 changed files with 23 additions and 9 deletions

View File

@@ -25,7 +25,6 @@ Automagical css image gallery in [Hugo](https://gohugo.io/) using shortcodes. Li
- Captions / title
- Alternative text
- Disable lightbox
- Automatically detect whether source is an image or directory
- Support a micture of dirs and single images
@@ -44,12 +43,13 @@ Quickstart:
- `{{< snap-gallery src="image1.jpg, image2.png" >}}`: Display these two images in **gallery** mode
- `{{< snap-gallery src="image1.jpg image2.png" mode="slideshow" >}}`: Display these two images in **slideshow** mode
- `{{< snap-gallery src="img/page1" >}}`: Display all images in the folder `img/page1` in **gallery** mode
- `{{< snap-gallery src="img/page1" isdir=true >}}`: Display all images in the folder `img/page1` in **gallery** mode
All parameters:
- `src`: Must contain either a comma-separated list of paths to images, or a directory path containing images.
- `isdir`: Whether `src` contains one or multiple individual images, ow a whole directory. Default: `false`.
- `lightbox`: Whether a click on an image shall open a lightbox modal. Default: `true`.
- `mode`: Can be either `gallery` or `slideshow`. Default: `gallery`.
- For gallery mode:
- `columns`: Amount of columns the images are displayed in. Default: `4`.
@@ -59,6 +59,8 @@ All parameters:
- `slideshowrotate`: Whether the slideshow shall automatically rotate through the images. Default: `true`.
- `slideshowrotate_timer`: Interval of automatic slideshow rotation (if enabled), in milliseconds. Default: `5000` (5 seconds).
**Note: Boolean values (`true`/`false`) must be provided without surrounding `"` characters!** `lightbox=false` disables the lightbox, while `lightbox="false"` does not.
## Credits
The original inspiration for this shortcode came from [Li-Wen Yip's easy-gallery](https://github.com/liwenyip/hugo-easy-gallery). The first major version of this was already a 90% rewrite, and the current one has even less to do with it. However, the rewrite took some inspirations from [W3Schools](https://www.w3schools.com/howto/howto_js_lightbox.asp), thanks!