Photoswipe now allows alternate text for caption

Adding changes from hugo-easy-gallery
f0e6d5d62f58284beadf98db71861af90f2cff8e
This commit is contained in:
Michael Romero 2017-04-02 22:15:03 -07:00
parent e214c15e36
commit 2a110c80e5
2 changed files with 5 additions and 4 deletions

View File

@ -10,7 +10,7 @@ Beautiful Hugo adds a few custom shortcodes created by [Li-Wen Yip](https://www.
{{< gallery caption-effect="fade" >}}
{{< figure thumb="-thumb" link="/img/hexagon.jpg" >}}
{{< figure thumb="-thumb" link="/img/sphere.jpg" caption="Sphere" >}}
{{< figure thumb="-thumb" link="/img/triangle.jpg" caption="This is a long comment about a triangle" >}}
{{< figure thumb="-thumb" link="/img/triangle.jpg" caption="Triangle" alt="This is a long comment about a triangle" >}}
{{< /gallery >}}
{{< load-photoswipe >}}
@ -21,7 +21,7 @@ The above gallery was created using the following shortcodes:
{{</* gallery caption-effect="fade" */>}}
{{</* figure thumb="-thumb" link="/img/hexagon.jpg" */>}}
{{</* figure thumb="-thumb" link="/img/sphere.jpg" caption="Sphere" */>}}
{{</* figure thumb="-thumb" link="/img/triangle.jpg" caption="This is a long comment about a triangle" */>}}
{{</* figure thumb="-thumb" link="/img/triangle.jpg" caption="Triangle" alt="This is a long comment about a triangle" */>}}
{{</* /gallery */>}}
{{</* load-photoswipe */>}}
```

View File

@ -15,9 +15,10 @@ $( document ).ready(function() {
// get properties from child a/img/figcaption elements,
var $figure = $(this),
$a = $figure.find('a'),
$img = $figure.find('img'),
$src = $a.attr('href'),
$title = $figure.find('figcaption').html(),
$msrc = $figure.find('img').attr('src');
$title = $img.attr('alt'),
$msrc = $img.attr('src');
// if data-size on <a> tag is set, read it and create an item
if ($a.data('size')) {
var $size = $a.data('size').split('x');