Allow changing of gallery image size
This commit is contained in:
parent
c16b3ab59f
commit
945a114f08
@ -10,7 +10,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#gallery').nanogallery2({
|
$('#gallery').nanogallery2({
|
||||||
thumbnailHeight: 200,
|
thumbnailHeight: galleryUseHeight,
|
||||||
thumbnailWidth: 'auto',
|
thumbnailWidth: 'auto',
|
||||||
|
|
||||||
thumbnailGutterWidth: 10,
|
thumbnailGutterWidth: 10,
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
{{- $first := true -}}
|
{{- $first := true -}}
|
||||||
{{- $filter := images.AutoOrient -}}
|
{{- $filter := images.AutoOrient -}}
|
||||||
{{- $teaser := .Resources.GetMatch "thumbnail.jpg" -}}
|
{{- $teaser := .Resources.GetMatch "thumbnail.jpg" -}}
|
||||||
|
{{- $galleryHeight := 200 }}
|
||||||
|
{{- with site.Params.galleryUseHeight }}
|
||||||
|
{{- $galleryHeight = . | int }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Page.Params.galleryUseHeight }}
|
||||||
|
{{- $galleryHeight = . | int }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $galleryWidth := mul $galleryHeight 1.5 | math.Round | int -}}
|
||||||
|
{{- $gallerySize := printf "%dx%d" $galleryWidth $galleryHeight -}}
|
||||||
{{- range .Resources.ByType "image" -}}
|
{{- range .Resources.ByType "image" -}}
|
||||||
{{- if not (eq $teaser .) -}}
|
{{- if not (eq $teaser .) -}}
|
||||||
{{- if not $first }}, {{ end }}
|
{{- if not $first }}, {{ end }}
|
||||||
@ -11,7 +20,7 @@
|
|||||||
"url": "{{ .RelPermalink }}",
|
"url": "{{ .RelPermalink }}",
|
||||||
"width": "{{ .Width }}",
|
"width": "{{ .Width }}",
|
||||||
"height": "{{ .Height }}",
|
"height": "{{ .Height }}",
|
||||||
"thumbnail": "{{ (.Fit "300x200").RelPermalink }}"
|
"thumbnail": "{{ (.Fit $gallerySize).RelPermalink }}"
|
||||||
}
|
}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -13,4 +13,14 @@
|
|||||||
<!-- <script src="{{ .Page.Site.BaseURL }}/js/main.js" defer></script> -->
|
<!-- <script src="{{ .Page.Site.BaseURL }}/js/main.js" defer></script> -->
|
||||||
<script src="{{ (resources.Get "js/jquery.min.js").RelPermalink }}"></script>
|
<script src="{{ (resources.Get "js/jquery.min.js").RelPermalink }}"></script>
|
||||||
<script src="{{ (resources.Get "js/jquery.nanogallery2.min.js").RelPermalink }}" defer></script>
|
<script src="{{ (resources.Get "js/jquery.nanogallery2.min.js").RelPermalink }}" defer></script>
|
||||||
|
<script>
|
||||||
|
{{- $galleryHeight := 200 }}
|
||||||
|
{{- with site.Params.galleryUseHeight }}
|
||||||
|
{{- $galleryHeight = . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Page.Params.galleryUseHeight }}
|
||||||
|
{{- $galleryHeight = . }}
|
||||||
|
{{- end }}
|
||||||
|
var galleryUseHeight = {{ $galleryHeight }};
|
||||||
|
</script>
|
||||||
<script src="{{ (resources.Get "/js/gallery.js").RelPermalink }}" defer></script>
|
<script src="{{ (resources.Get "/js/gallery.js").RelPermalink }}" defer></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user