Skip to content

Commit a330442

Browse files
committed
Add parameter swipeboxParameters, it allows to directly set any parameter of Swipebox.
Fix parameter justifiedGalleryParameters to actually set any parameter of Justified Gallery (before the parameters were passed to Swipebox).
1 parent 75776c9 commit a330442

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

layouts/shortcodes/gallery.html

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
{{ $showExif := .Get "showExif" | default (.Site.Params.galleryShowExif | default false) }}
3232

33+
{{ $swipeboxParameters := .Get "swipeboxParameters" | default (.Site.Params.gallerySwipeboxParameters | default "") }}
34+
3335
{{ $justifiedGalleryParameters := .Get "justifiedGalleryParameters" | default (.Site.Params.galleryJustifiedGalleryParameters | default "") }}
3436

3537
{{ $previewType := .Get "previewType" | default (.Site.Params.galleryPreviewType | default "blur") }}
@@ -228,28 +230,31 @@
228230

229231
swipeboxInstance = $('.galleryImg').swipebox(
230232
$.extend({},
231-
{ {{ $justifiedGalleryParameters | safeJS }} }
233+
{ {{ $swipeboxParameters | safeJS }} }
232234
)
233235
);
234236
});
235237

236238
// initialize the justified gallery
237-
gallery.justifiedGallery({
238-
rowHeight : {{ $rowHeight }},
239-
margins : {{ $margins }},
240-
border : 0,
241-
randomize : {{ $randomize }},
242-
waitThumbnailsLoad : false,
243-
lastRow : {{ $lastRowJustification }},
244-
captions : false,
245-
// if there is at least one filter option
246-
{{ if not (eq $filterOptions "[]") }}
247-
// we first show no images at all
248-
// till the code way below selects a filter and applies it
249-
// this prevent creating the layout twice
250-
filter : () => false
251-
{{ end }}
252-
});
239+
gallery.justifiedGallery($.extend(
240+
{
241+
rowHeight : {{ $rowHeight }},
242+
margins : {{ $margins }},
243+
border : 0,
244+
randomize : {{ $randomize }},
245+
waitThumbnailsLoad : false,
246+
lastRow : {{ $lastRowJustification }},
247+
captions : false,
248+
// if there is at least one filter option
249+
{{ if not (eq $filterOptions "[]") }}
250+
// we first show no images at all
251+
// till the code way below selects a filter and applies it
252+
// this prevent creating the layout twice
253+
filter : () => false
254+
{{ end }}
255+
},
256+
{ {{ $justifiedGalleryParameters | safeJS }} }
257+
));
253258

254259
// only include JS code for filter options if there at least one filter option
255260
{{ if not (eq $filterOptions "[]") }}

0 commit comments

Comments
 (0)