diff options
author | Tyler Flowers <contact@ggtylerr.dev> | 2023-12-17 22:23:28 -0500 |
---|---|---|
committer | Tyler Flowers <contact@ggtylerr.dev> | 2023-12-17 22:23:28 -0500 |
commit | a79d129d410ab8cad9ea8f2d56201d53b22c8024 (patch) | |
tree | a381ffee1590f4526b098ef4fb3c234aeef73387 /apps/website/src | |
parent | fa189e92efa35b887530d3c3c6eb64b0e95aec63 (diff) | |
download | Nexus-a79d129d410ab8cad9ea8f2d56201d53b22c8024.tar.gz Nexus-a79d129d410ab8cad9ea8f2d56201d53b22c8024.tar.bz2 Nexus-a79d129d410ab8cad9ea8f2d56201d53b22c8024.zip |
Fix up Slider to accept differing cards
Diffstat (limited to 'apps/website/src')
-rw-r--r-- | apps/website/src/components/base/Slider.astro | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/apps/website/src/components/base/Slider.astro b/apps/website/src/components/base/Slider.astro index f40b747..8814f63 100644 --- a/apps/website/src/components/base/Slider.astro +++ b/apps/website/src/components/base/Slider.astro @@ -20,19 +20,28 @@ const { </div> <!-- might be cheating a bit using global styles here but at least it lets you use slots --> -<style is:global> - .slider > * { - animation: 5s linear infinite slide; +<style is:global lang="scss"> + $sliderNum: 8; + @for $i from 1 through $sliderNum { + .slider > *:nth-child(#{$i}) { + animation: #{"slide" + $i} 10s linear infinite; + } + @keyframes #{"slide" + $i} { + 0% { + transform: translateX(0); + } + #{calc(100% / $sliderNum * $i)} { + transform: translateX(calc((-100% - 10px) * $i)); + } + #{calc((100% / $sliderNum * $i) + 0.001%)} { + transform: translateX(calc((100% + 10px) * ($sliderNum - $i))); + } + 100% { + transform: translateX(0); + } + } } .slider.reverse > * { animation-direction: reverse; } - @keyframes slide { - from { - transform: translateX(0); - } - to { - transform: translateX(calc(-100% - 10px)); - } - } </style> |