fix(carousel): with templating generation
This commit is contained in:
parent
bb0d92ead7
commit
d96122050d
2 changed files with 28 additions and 58 deletions
|
@ -227,67 +227,33 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
{{ $slides_count := 6 }}
|
||||
<section class="carousel-container">
|
||||
<div class="carousel" aria-label="Gallery">
|
||||
<ol class="carousel__viewport">
|
||||
<li id="carousel__slide1"
|
||||
tabindex="0"
|
||||
class="carousel__slide">
|
||||
<div class="carousel__snapper">
|
||||
<a href="#carousel__slide4"
|
||||
class="carousel__prev">Diapositive précédente</a>
|
||||
<a href="#carousel__slide2"
|
||||
class="carousel__next">Diapositive suivante</a>
|
||||
</div>
|
||||
</li>
|
||||
<li id="carousel__slide2"
|
||||
tabindex="0"
|
||||
class="carousel__slide">
|
||||
<div class="carousel__snapper"></div>
|
||||
<a href="#carousel__slide1"
|
||||
class="carousel__prev">Diapositive précédente</a>
|
||||
<a href="#carousel__slide3"
|
||||
class="carousel__next">Diapositive suivante</a>
|
||||
</li>
|
||||
<li id="carousel__slide3"
|
||||
tabindex="0"
|
||||
class="carousel__slide">
|
||||
<div class="carousel__snapper"></div>
|
||||
<a href="#carousel__slide2"
|
||||
class="carousel__prev">Diapositive précédente</a>
|
||||
<a href="#carousel__slide4"
|
||||
class="carousel__next">Diapositive suivante</a>
|
||||
</li>
|
||||
<li id="carousel__slide4"
|
||||
tabindex="0"
|
||||
class="carousel__slide">
|
||||
<div class="carousel__snapper"></div>
|
||||
<a href="#carousel__slide3"
|
||||
class="carousel__prev">Diapositive précédente</a>
|
||||
<a href="#carousel__slide1"
|
||||
class="carousel__next">Diapositive suivante</a>
|
||||
</li>
|
||||
</ol>
|
||||
<aside class="carousel__navigation">
|
||||
<ol class="carousel__navigation-list">
|
||||
<li class="carousel__navigation-item enabled">
|
||||
<a href="#carousel__slide1"
|
||||
class="carousel__navigation-button">1ère diapositive</a>
|
||||
</li>
|
||||
<li class="carousel__navigation-item">
|
||||
<a href="#carousel__slide2"
|
||||
class="carousel__navigation-button">2ème diapositive</a>
|
||||
</li>
|
||||
<li class="carousel__navigation-item">
|
||||
<a href="#carousel__slide3"
|
||||
class="carousel__navigation-button">3ème diapositive</a>
|
||||
</li>
|
||||
<li class="carousel__navigation-item">
|
||||
<a href="#carousel__slide4"
|
||||
class="carousel__navigation-button">4ème diapositive</a>
|
||||
</li>
|
||||
<ol class="carousel__viewport">
|
||||
{{ range $index, $s := seq (sub $slides_count 0) }}
|
||||
<li id="carousel__slide{{ $index }}"
|
||||
tabindex="0"
|
||||
class="carousel__slide">
|
||||
<div class="carousel__snapper">
|
||||
<a href="#carousel__slide{{ partial "fullmod" (slice (sub $index 1) $slides_count) }}"
|
||||
class="carousel__prev">Diapositive précédente</a>
|
||||
<a href="#carousel__slide{{ partial "fullmod" (slice (add $index 1) $slides_count) }}"
|
||||
class="carousel__next">Diapositive suivante</a>
|
||||
</div>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</aside>
|
||||
<aside class="carousel__navigation">
|
||||
<ol class="carousel__navigation-list">
|
||||
{{ range $index, $s := seq (sub $slides_count 0) }}
|
||||
<li class="carousel__navigation-item {{ if eq $index 0 }}enabled{{- end -}}">
|
||||
<a href="#carousel__slide{{ $index }}"
|
||||
class="carousel__navigation-button">{{ $index }}ème diapositive</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
|
4
layouts/partials/fullmod.html
Normal file
4
layouts/partials/fullmod.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{- $a := index . 0 -}}
|
||||
{{- $b := index . 1 -}}
|
||||
{{- $c := mod $a $b -}}
|
||||
{{- if lt $c 0 -}}{{- add $c $b -}}{{- else -}}{{- $c -}}{{- end -}}
|
Loading…
Reference in a new issue