hugo-theme-zzo/layouts/partials/header/header-slide.html

47 lines
1.7 KiB
HTML
Raw Normal View History

{{ if $.Params.header }}
<div class="swiper-container">
<div class="swiper-wrapper">
{{ range $.Params.header }}
{{ if eq .type "slide" }}
{{ $height := .height }}
{{ range .slide }}
<div class="swiper-slide site-header site-header__align-{{ .align }}" style="background-image: url('{{.image | relURL }}'); height: {{ $height }}px;">
{{ $header := . }}
{{ if .title }}
{{ range .title }}
<div class="site-header__title" style="font-size: {{ $header.titleFontSize }}px; padding: {{ $header.paddingY }}px {{ $header.paddingX }}px;">
{{ . }}
</div>
{{ end }}
{{ end }}
{{ if .spaceBetweenTitleSubtitle }}
<div style="height: {{ .spaceBetweenTitleSubtitle }}px"></div>
{{ end }}
{{ if .subtitle }}
{{ range .subtitle }}
<div class="site-header__subtitle" style="font-size: {{ $header.subtitleFontSize }}px; padding: {{ $header.paddingY }}px {{ $header.paddingX }}px;">
{{ . }}
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
<div class="swiper-pagination"></div>
</div>
{{ end }}
{{ $js := .Site.Data.lib.js }}
{{ $css := .Site.Data.lib.css }}
2019-12-01 11:58:24 +00:00
<link rel="stylesheet" href="{{ $css.swiper.url }}" integrity="{{ $css.swiper.sri }}" crossorigin="anonymous">
<script src="{{ $js.swiper.url }}" integrity="{{ $js.swiper.sri }}" crossorigin="anonymous"></script>
<script>
{{ $swiper := .Site.Data.swiper }}
var options = JSON.parse({{ $swiper | jsonify }});
var mySwiper = new Swiper('.swiper-container', options);
</script>