Shopify themes, liquid, logos, and UX
Currently, I have the text "Free delivery over $100" at the top bar of my site. Below is the screenshot of my top bar.
How do I add the next line of text so that the top bar will slide to show another text after a few seconds? Currently, I have the following code. However, I do not know what I can do to input instructions for the next text in another slide. Can someone help me with this?
<body>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.text-slider {
overflow: hidden;
width: 100%;
max-width: 700px;
margin: auto;
font-size: 15px;
font-weight: 400;
text-align: center;
}
.text-slider-inner {
display: flex;
transition: transform 0.5s ease-in-out;
}
.text-item {
min-width: 100%;
box-sizing: border-box;
text-item: center;
}
</style>
<div class="text-slider">
<div class="text-slider-inner">
<div class="text-item">Free delivery over $100.</div>
<script>
const textSliderInner = document.querySelector('.text-slider-inner');
function nextText() {
const lastText = document.querySelector('.text-item:last-child');
textSliderInner.style.transition = 'transform 0.5s ease-in-out';
textSliderInner.style.transform = 'translateX(' + (-lastText.offsetWidth) + 'px)';
setTimeout(() => {
textSliderInner.style.transition = 'none';
textSliderInner.style.transform = 'translateX(0)';
textSliderInner.prepend(lastText);
}, 500);
}
setInterval(nextText, 3000); // Change text every 3 seconds
</script>
</div>
</div>
</body>
@growteamsg you will have announcement bar settings in customize settings of the theme, did you check customize settings?
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025