Created
August 10, 2023 15:31
-
-
Save leemartin/81f1748547acdd9d7fb1d54c9db7ec98 to your computer and use it in GitHub Desktop.
Vue 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
<template> | |
<div id="marquee"> | |
<div class="inner"> | |
<div class="message">{{ message }}</div> | |
<div class="message">{{ message }}</div> | |
</div> | |
</div> | |
</template> | |
<script setup> | |
// Define props | |
defineProps(['message']) | |
</script> | |
<style lang="postcss" scoped> | |
#marquee{ | |
@apply bg-black dark:bg-white overflow-hidden text-white dark:text-black; | |
} | |
.inner{ | |
@apply flex py-2.5 md:py-3 lg:py-3.5 xl:py-4 2xl:py-[18px] w-max; | |
animation: scroll 15s linear infinite; | |
} | |
.message{ | |
@apply px-5 md:px-6 lg:px-7 xl:px-8 2xl:px-9; | |
} | |
@keyframes scroll { | |
from { | |
transform: translateX(0%); | |
} | |
to { | |
transform: translateX(-50%); | |
} | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment