Rename duration to interval

This commit is contained in:
Mircea-Pavel ANTON 2023-02-02 19:31:27 +00:00
parent 73ccf044e8
commit 405e35d5f4
2 changed files with 5 additions and 5 deletions

View file

@ -106,7 +106,7 @@ Call to action
| ------------- | ----------------------------------------------------------------------------------------------------------------- | | ------------- | ----------------------------------------------------------------------------------------------------------------- |
| `images` | **Required.** A regex string to match image names. | | `images` | **Required.** A regex string to match image names. |
| `aspectRatio` | **Optional.** The aspect ratio for the carousel. Either `16-9`, `21-9` or `32-9`. It is set to `16-9` by default. | | `aspectRatio` | **Optional.** The aspect ratio for the carousel. Either `16-9`, `21-9` or `32-9`. It is set to `16-9` by default. |
| `duration` | **Optional.** The duration for the auto-scrooling, specified in milliseconds. Defaults to `2000` (2s) | | `interval` | **Optional.** The interval for the auto-scrooling, specified in milliseconds. Defaults to `2000` (2s) |
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
**Example 1:** 16:9 aspect ratio and verbose list of images **Example 1:** 16:9 aspect ratio and verbose list of images
@ -120,10 +120,10 @@ Call to action
**Example 2:** 21:9 aspect ratio and regex-ed list of images **Example 2:** 21:9 aspect ratio and regex-ed list of images
```md ```md
{{</* carousel images="gallery/*" aspectRatio="21-9" duration="2500" */>}} {{</* carousel images="gallery/*" aspectRatio="21-9" interval="2500" */>}}
``` ```
{{< carousel images="gallery/*" aspectRatio="21-9" duration="2500" >}} {{< carousel images="gallery/*" aspectRatio="21-9" interval="2500" >}}
<br/><br/><br/> <br/><br/><br/>

View file

@ -2,7 +2,7 @@
{{ $id := delimit (slice "gallery" $time) "-" }} {{ $id := delimit (slice "gallery" $time) "-" }}
{{ $aspect := default "16-9" (.Get "aspectRatio") }} {{ $aspect := default "16-9" (.Get "aspectRatio") }}
{{ $images := .Page.Resources.Match (.Get "images") }} {{ $images := .Page.Resources.Match (.Get "images") }}
{{ $duration := default "2000" (.Get "duration") }} {{ $interval := default "2000" (.Get "interval") }}
<div id="{{ $id }}" class="carousel slide relative" data-bs-ride="carousel"> <div id="{{ $id }}" class="carousel slide relative" data-bs-ride="carousel">
<div class="carousel-indicators absolute right-0 bottom-0 left-0 flex justify-center p-0 mb-2"> <div class="carousel-indicators absolute right-0 bottom-0 left-0 flex justify-center p-0 mb-2">
@ -24,7 +24,7 @@
<div class="carousel-item {{ if eq $num 0 }} active {{ end }} relative float-left w-full ratio-{{ $aspect }} single_hero_background" <div class="carousel-item {{ if eq $num 0 }} active {{ end }} relative float-left w-full ratio-{{ $aspect }} single_hero_background"
style="background-image:url({{ . }})" style="background-image:url({{ . }})"
data-bs-interval="{{ $duration }}" data-bs-interval="{{ $interval }}"
></div> ></div>
{{ $num = add $num 1 }} {{ $num = add $num 1 }}
{{ end }} {{ end }}