Last active
March 17, 2023 17:37
-
-
Save LeoSeyers/4e5b94d7a22ce87cc28065992ae312f6 to your computer and use it in GitHub Desktop.
Marquee Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@keyframes marquee { | |
0% { | |
transform: translateX(0); | |
} | |
100% { | |
transform: translateX(var(--offset)); | |
} | |
} | |
.c-marquee { | |
--scrolling-speed: 2s; | |
--offset: -50%; | |
display: flex; | |
width: 100%; | |
overflow: hidden; | |
@include max-width(tab-lg) { | |
align-items: center; | |
height: var(--c-header); | |
} | |
span { | |
position: relative; | |
width: fit-content; | |
padding-right: var(--padding); | |
white-space: nowrap; | |
} | |
&:not(.is-enabled) span { | |
animation: marquee var(--scrolling-speed) linear infinite; | |
} | |
&__inner { | |
position: relative; | |
display: flex; | |
align-items: center; | |
width: fit-content; | |
transition: opacity 1s; | |
will-change: transform; | |
span { | |
width: fit-content; | |
white-space: nowrap; | |
&::after { | |
margin-left: var(--padding); | |
content: "· "; | |
} | |
} | |
} | |
} |
Author
LeoSeyers
commented
Mar 1, 2023
•
<div class="c-marquee">
<div class="c-marquee__inner">
<span></span>
<span></span>
<span></span>
</div>
</div>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment