From ccf5e24f55166fd92df8a0ccd5c4f95985ab59c5 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Sun, 27 Jul 2025 00:35:31 +0800 Subject: [PATCH] fix(carousel): interval not working --- layouts/shortcodes/carousel.html | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/layouts/shortcodes/carousel.html b/layouts/shortcodes/carousel.html index c6b844a9..e719a8d3 100644 --- a/layouts/shortcodes/carousel.html +++ b/layouts/shortcodes/carousel.html @@ -1,4 +1,4 @@ -{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .)) "-" }} +{{ $id := delimit (slice "carousel" (partial "functions/uid.html" .) (now.UnixNano)) "-" }} {{ $aspect := default "16-9" (.Get "aspectRatio") }} {{ $interval := default "2000" (.Get "interval") }} @@ -17,7 +17,12 @@ {{ end }} -
+
@@ -30,32 +35,27 @@ {{ if eq $num 0 }}data-twe-carousel-active aria-current="true"{{ end }} class="mx-[3px] box-content h-[3px] w-[30px] flex-initial cursor-pointer border-0 border-y-[10px] border-solid border-transparent bg-neutral bg-clip-padding p-0 -indent-[999px] opacity-50 transition-opacity duration-[600ms] ease-[cubic-bezier(0.25,0.1,0.25,1.0)] motion-reduce:transition-none" aria-label="Slide {{ $num }}"> - {{ $num = add $num 1 }} {{ end }} -
+
- {{ $num := 0 }} - {{ range $images }} + {{ range $index, $image := $images }} + {{ $hiddenClass := cond (eq $index 0) "" "hidden" }} - - {{ $num = add $num 1 }} {{ end }} -
+ +