Skip to content

Instantly share code, notes, and snippets.

@bran921007
Created December 21, 2024 03:23
Show Gist options
  • Save bran921007/05b7e28164b3b862674641bd5be1e2ee to your computer and use it in GitHub Desktop.
Save bran921007/05b7e28164b3b862674641bd5be1e2ee to your computer and use it in GitHub Desktop.
Marquee bar html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marquee Example</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"/>
<style>
.marquee-carousel {
background-color: rgba(254, 241, 225);
padding: 1rem 0;
}
.marquee-carousel__slide {
position: relative;
margin: 0.125rem 6rem 0.125rem 0;
white-space: nowrap;
}
.marquee-carousel__slide::after {
content: '•';
position: absolute;
right: -3rem;
top: 50%;
transform: translateY(-50%);
}
.font-bold {
font-weight: bold;
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem;
}
.text-black {
color: black;
}
/* Hide arrows and dots */
.slick-arrow,
.slick-dots {
display: none !important;
}
</style>
</head>
<body>
<section class="marquee">
<div class="marquee-carousel" id="marquee-carousel">
<div class="marquee-carousel__slide font-bold text-2xl text-black">
No added sugar or seed oils
</div>
<div class="marquee-carousel__slide font-bold text-2xl text-black">
America's #1 Keto Brand
</div>
<div class="marquee-carousel__slide font-bold text-2xl text-black">
Clean Ingredients
</div>
</div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<script>
$(document).ready(function() {
// Wait a brief moment to ensure DOM is fully loaded
$('#marquee-carousel').slick({
speed: 5000,
autoplay: true,
autoplaySpeed: 0,
centerMode: true,
cssEase: 'linear',
slidesToShow: 1,
slidesToScroll: 1,
variableWidth: true,
infinite: true,
initialSlide: 1,
arrows: false,
buttons: false,
pauseOnHover: false,
draggable: false,
swipe: false,
touchMove: false
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment