add slideshow functionality, adapt JS, adapt CSS
This commit is contained in:
@@ -2,6 +2,17 @@
|
||||
{{- $.Page.Scratch.Add "gallerycount" 1 -}}
|
||||
{{ $galno := $.Page.Scratch.Get "gallerycount" }}
|
||||
|
||||
{{/* Load CSS/JS and make sure it is only loaded once */}}
|
||||
{{- if eq ($.Page.Scratch.Get "gallerycount") 1 }}
|
||||
{{- with resources.Get "scss/snap-gallery.scss" | toCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
<script src="/js/snap-gallery.js"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Initialise index of this gallery */}}
|
||||
<script>imageIndex[{{ $galno }}] = 1;</script>
|
||||
|
||||
{{/* Initialise variables holding image paths */}}
|
||||
{{ $imgs := slice }}
|
||||
|
||||
@@ -19,16 +30,17 @@
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Visible images in gallery mode */}}
|
||||
{{/* Visible images in separate modes */}}
|
||||
{{ $mode := default "gallery" .Params.mode }}
|
||||
{{/* Gallery mode */}}
|
||||
{{ if eq $mode "gallery" }}
|
||||
{{ partial "gallery" (dict "columns" .Params.columns "minwidth" .Params.minwidth "imgs" $imgs "galno" $galno) }}
|
||||
{{/* Slideshow mode */}}
|
||||
{{ else if eq $mode "slideshow" }}
|
||||
{{ partial "slideshow" (dict "imgs" $imgs "galno" $galno) }}
|
||||
{{/* Set autorotate timer for slideshow */}}
|
||||
<script>setInterval(moveSlideshowItem, 5000, {{ $galno }}, 1);</script>
|
||||
{{ end }}
|
||||
|
||||
{{/* The Modal/Lightbox */}}
|
||||
{{ partial "lightbox" (dict "galno" $galno "imgs" $imgs) }}
|
||||
|
||||
{{/* Load CSS/JS and make sure it is only loaded once */}}
|
||||
{{- if eq ($.Page.Scratch.Get "gallerycount") 1 }}
|
||||
{{- with resources.Get "scss/snap-gallery.scss" | toCSS }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
<script src="/js/snap-gallery.js"></script>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user