Last active
February 12, 2022 20:32
-
-
Save koolamusic/caeaa37642b974ab981a560c1f84c91d to your computer and use it in GitHub Desktop.
Horizontal Scroll
This file contains 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
const HorizontalScroll = styled.div` | |
position: relative; | |
overflow: hidden; | |
--offset: 20vw; | |
--move-initial: calc(-25% + var(--offset)); | |
--move-final: calc(-50% + var(--offset)); | |
div { | |
width: fit-content; | |
display: flex; | |
position: relative; | |
transform: translate3d(var(--move-initial), 0, 0); | |
animation: marquee 5s linear infinite; | |
animation-play-state: paused; | |
} | |
@keyframes { | |
0% { | |
transform: translate3d(var(--move-initial), 0, 0); | |
} | |
100% { | |
transform: translate3d(var(--move-final), 0, 0); | |
} | |
} | |
` |
This file contains 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
<HorizontalScroll> | |
<div> | |
Insert the Content you want to scroll | |
</div> | |
</HorizontalScroll> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment