
Announcement Bar 3
A dynamic, sliding announcement bar featuring multiple messages with integrated SVG icons. It includes navigation arrows and a smooth transition effect to rotate through shipping, return, and social proof announcements.
- Auto-sliding message track
- Integrated SVG iconography
- Manual navigation arrows (Left/Right)
- Mobile-responsive visibility logic
- Infinite loop content duplication
- Promoting multiple offers simultaneously (Free Shipping, Returns, Reviews) without cluttering the header.
- Improving store trust by cycling through satisfaction guarantees and order counts.
- Most Shopify themes
The code
1<!-- INICIO BARRA DE ANUNCIOS DINAMICA -->2<div class="barra-de-anuncio">3 <div class="container">4 <div class="barra-de-anuncio__inner">5 <button class="barra-de-anuncio__nav barra-de-anuncio__nav--left">‹</button>6 <div class="barra-de-anuncio__slider">7 <div class="barra-de-anuncio__track">8 <!-- Original Content -->9 <div class="barra-de-anuncio__content">10 <svg class="announcesvg" fill="#ffffff" height="24px" width="24px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" xml:space="preserve" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <g> <path d="M458.671,214.24v-11.571c0-17.645-14.354-32-32-32H320v-53.337c0-5.891-4.775-10.667-10.667-10.667h-32.001V74.67 c0-5.891-4.776-10.667-10.667-10.667H121.759L103.545,45.79c-4.164-4.165-10.918-4.165-15.084,0l-60.878,60.875H10.667 C4.776,106.666,0,111.441,0,117.332v298.668c0,5.89,4.776,10.667,10.667,10.667h43.739c1.605,7.878,4.954,15.129,9.622,21.333 H42.666C36.775,448,32,452.777,32,458.667s4.775,10.667,10.667,10.667h63.997c0.027,0,0.052-0.004,0.079-0.004 c25.72-0.037,47.231-18.373,52.181-42.662h150.409h43.747c1.605,7.878,4.955,15.129,9.623,21.333H341.34 c-5.89,0-10.667,4.776-10.667,10.667s4.776,10.667,10.667,10.667h63.997c0.027,0,0.053-0.004,0.08-0.004 c25.72-0.037,47.231-18.373,52.181-42.662h43.735c5.891,0,10.667-4.776,10.667-10.667v-96.001v-42.669 C512,245.679,488.896,219.336,458.671,214.24z M255.999,85.337v21.329h-91.576l-21.33-21.329H255.999z M96.003,68.417 l13.788,13.787c0.005,0.005,0.011,0.011,0.016,0.016l24.446,24.446H57.754L96.003,68.417z M106.666,447.998 c-17.646,0-32.001-14.354-32.001-31.998c0-17.646,14.355-32.002,32.001-32.002c17.644,0,31.998,14.356,31.998,32.002 C138.663,433.644,124.309,447.998,106.666,447.998z M298.666,181.336v181.332h-72.543c-5.891,0-10.667,4.776-10.667,10.667 s4.775,10.667,10.667,10.667h72.543v21.333H158.924c-4.955-24.316-26.503-42.668-52.258-42.668 c-25.755,0-47.306,18.353-52.261,42.668H21.333V234.668h42.665c5.89,0,10.667-4.775,10.667-10.667 c0-5.891-4.776-10.667-10.667-10.667H21.333v-21.332H149.33c5.891,0,10.667-4.775,10.667-10.667 c0-5.891-4.775-10.667-10.667-10.667H21.333v-42.671h10.66c0.006,0,0.012,0,0.017,0h266.656V181.336z M353.08,405.334H320 v-21.333h42.701C358.032,390.206,354.684,397.456,353.08,405.334z M437.337,416.035c-0.019,17.629-14.366,31.963-31.998,31.963 c-17.645,0-32.001-14.354-32.001-31.998c0-17.619,14.311-31.955,31.919-32h0.08c0.01,0,0.019-0.001,0.028-0.001 c17.621,0.014,31.953,14.346,31.972,31.967c0,0.012-0.001,0.022-0.001,0.034C437.336,416.012,437.337,416.023,437.337,416.035z M490.667,405.334h-33.069c-4.956-24.316-26.504-42.668-52.259-42.668c-0.028,0-0.055,0.002-0.082,0.002h-85.258V192.003h106.672 c5.882,0,10.667,4.785,10.667,10.667v10.666h-74.666c-5.89,0-10.667,4.775-10.667,10.667v95.998 c0,5.891,4.776,10.667,10.667,10.667h127.995V405.334z M394.673,234.668v74.665h-21.334v-74.665H394.673z M490.667,309.333 h-74.661v-74.665h31.999c23.524,0,42.662,19.138,42.662,42.663V309.333z"></path> <path d="M184.397,384.001h6.658c5.89,0,10.667-4.776,10.667-10.667s-4.776-10.667-10.667-10.667h-6.658 c-5.891,0-10.667,4.776-10.667,10.667S178.507,384.001,184.397,384.001z"></path> <path d="M184.397,192.003h6.658c5.89,0,10.667-4.775,10.667-10.667c0-5.891-4.776-10.667-10.667-10.667h-6.658 c-5.891,0-10.667,4.775-10.667,10.667C173.731,187.227,178.507,192.003,184.397,192.003z"></path> </g> </g> </g> </g>11 </svg>12 Envio gratis para todo el Peru13 </div>14 <div class="barra-de-anuncio__content mobhide">15 <svg class="announcesvg" viewBox="0 0 23 24" role="presentation">16 <g transform="translate(1 1)" stroke-width="2" fill="none" fill-rule="evenodd">17 <path stroke="white" d="M8 4h8v7"></path>18 <path stroke="white" stroke-linecap="square" d="M11 7L8 4l3-3"></path>19 <circle stroke="white" stroke-linecap="square" cx="6" cy="20" r="2"></circle>20 <circle stroke="white" stroke-linecap="square" cx="18" cy="20" r="2"></circle>21 <path stroke="white" stroke-linecap="square" d="M21 5l-2 10H5L3 0H0"></path>22 </g>23 </svg>24 Devoluciones hasta en 30 dias25 </div>26 <div class="barra-de-anuncio__content mobhide">27 <svg class="announcesvg" viewBox="0 0 24 23" role="presentation">28 <g stroke-width="2" fill="none" fill-rule="evenodd">29 <path d="M17 1c-2.1 0-3.9 1.1-5 2.7C10.9 2.1 9.1 1 7 1 3.7 1 1 3.7 1 7c0 6 11 15 11 15s11-9 11-15c0-3.3-2.7-6-6-6z" stroke="white" stroke-linecap="square"></path>30 <path d="M16 5c1.65 0 3 1.35 3 3" stroke="white" stroke-linecap="round"></path>31 </g>32 </svg>33 Satisfaccion garantizada34 </div>35 <div class="barra-de-anuncio__content mobhide">36 <svg class="announcesvg" viewBox="0 0 24 24" role="presentation">37 <g stroke-width="2" fill="none" fill-rule="evenodd">38 <path d="M6.5 3.25l12 6" stroke="white"></path>39 <path stroke="white" d="M23 7l-10 5L1 6M13 12v11"></path>40 <path stroke="white" stroke-linecap="square" d="M23 7v10l-10 6-12-6V6l10-5z"></path>41 </g>42 </svg>43 Mas de 4823 pedidos entregados44 </div>45 <!-- Duplicated Content -->46 <div class="barra-de-anuncio__content">47 <svg class="announcesvg" fill="#ffffff" height="24px" width="24px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" xml:space="preserve" stroke="#ffffff"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <g> <path d="M458.671,214.24v-11.571c0-17.645-14.354-32-32-32H320v-53.337c0-5.891-4.775-10.667-10.667-10.667h-32.001V74.67 c0-5.891-4.776-10.667-10.667-10.667H121.759L103.545,45.79c-4.164-4.165-10.918-4.165-15.084,0l-60.878,60.875H10.667 C4.776,106.666,0,111.441,0,117.332v298.668c0,5.89,4.776,10.667,10.667,10.667h43.739c1.605,7.878,4.954,15.129,9.622,21.333 H42.666C36.775,448,32,452.777,32,458.667s4.775,10.667,10.667,10.667h63.997c0.027,0,0.052-0.004,0.079-0.004 c25.72-0.037,47.231-18.373,52.181-42.662h150.409h43.747c1.605,7.878,4.955,15.129,9.623,21.333H341.34 c-5.89,0-10.667,4.776-10.667,10.667s4.776,10.667,10.667,10.667h63.997c0.027,0,0.053-0.004,0.08-0.004 c25.72-0.037,47.231-18.373,52.181-42.662h43.735c5.891,0,10.667-4.776,10.667-10.667v-96.001v-42.669 C512,245.679,488.896,219.336,458.671,214.24z M255.999,85.337v21.329h-91.576l-21.33-21.329H255.999z M96.003,68.417 l13.788,13.787c0.005,0.005,0.011,0.011,0.016,0.016l24.446,24.446H57.754L96.003,68.417z M106.666,447.998 c-17.646,0-32.001-14.354-32.001-31.998c0-17.646,14.355-32.002,32.001-32.002c17.644,0,31.998,14.356,31.998,32.002 C138.663,433.644,124.309,447.998,106.666,447.998z M298.666,181.336v181.332h-72.543c-5.891,0-10.667,4.776-10.667,10.667 s4.775,10.667,10.667,10.667h72.543v21.333H158.924c-4.955-24.316-26.503-42.668-52.258-42.668 c-25.755,0-47.306,18.353-52.261,42.668H21.333V234.668h42.665c5.89,0,10.667-4.775,10.667-10.667 c0-5.891-4.776-10.667-10.667-10.667H21.333v-21.332H149.33c5.891,0,10.667-4.775,10.667-10.667 c0-5.891-4.775-10.667-10.667-10.667H21.333v-42.671h10.66c0.006,0,0.012,0,0.017,0h266.656V181.336z M353.08,405.334H320 v-21.333h42.701C358.032,390.206,354.684,397.456,353.08,405.334z M437.337,416.035c-0.019,17.629-14.366,31.963-31.998,31.963 c-17.645,0-32.001-14.354-32.001-31.998c0-17.619,14.311-31.955,31.919-32h0.08c0.01,0,0.019-0.001,0.028-0.001 c17.621,0.014,31.953,14.346,31.972,31.967c0,0.012-0.001,0.022-0.001,0.034C437.336,416.012,437.337,416.023,437.337,416.035z M490.667,405.334h-33.069c-4.956-24.316-26.504-42.668-52.259-42.668c-0.028,0-0.055,0.002-0.082,0.002h-85.258V192.003h106.672 c5.882,0,10.667,4.785,10.667,10.667v10.666h-74.666c-5.89,0-10.667,4.775-10.667,10.667v95.998 c0,5.891,4.776,10.667,10.667,10.667h127.995V405.334z M394.673,234.668v74.665h-21.334v-74.665H394.673z M490.667,309.333 h-74.661v-74.665h31.999c23.524,0,42.662,19.138,42.662,42.663V309.333z"></path> <path d="M184.397,384.001h6.658c5.89,0,10.667-4.776,10.667-10.667s-4.776-10.667-10.667-10.667h-6.658 c-5.891,0-10.667,4.776-10.667,10.667S178.507,384.001,184.397,384.001z"></path> <path d="M184.397,192.003h6.658c5.89,0,10.667-4.775,10.667-10.667c0-5.891-4.776-10.667-10.667-10.667h-6.658 c-5.891,0-10.667,4.775-10.667,10.667C173.731,187.227,178.507,192.003,184.397,192.003z"></path> </g> </g> </g> </g>48 </svg>49 Envio gratis para todo el Peru50 </div>51 <div class="barra-de-anuncio__content mobhide">52 <svg class="announcesvg" viewBox="0 0 23 24" role="presentation">53 <g transform="translate(1 1)" stroke-width="2" fill="none" fill-rule="evenodd">54 <path stroke="white" d="M8 4h8v7"></path>55 <path stroke="white" stroke-linecap="square" d="M11 7L8 4l3-3"></path>56 <circle stroke="white" stroke-linecap="square" cx="6" cy="20" r="2"></circle>57 <circle stroke="white" stroke-linecap="square" cx="18" cy="20" r="2"></circle>58 <path stroke="white" stroke-linecap="square" d="M21 5l-2 10H5L3 0H0"></path>59 </g>60 </svg>61 Devoluciones hasta en 30 dias62 </div>63 <div class="barra-de-anuncio__content mobhide">64 <svg class="announcesvg" viewBox="0 0 24 23" role="presentation">65 <g stroke-width="2" fill="none" fill-rule="evenodd">66 <path d="M17 1c-2.1 0-3.9 1.1-5 2.7C10.9 2.1 9.1 1 7 1 3.7 1 1 3.7 1 7c0 6 11 15 11 15s11-9 11-15c0-3.3-2.7-6-6-6z" stroke="white" stroke-linecap="square"></path>67 <path d="M16 5c1.65 0 3 1.35 3 3" stroke="white" stroke-linecap="round"></path>68 </g>69 </svg>70 Satisfaccion garantizada71 </div>72 <div class="barra-de-anuncio__content mobhide">73 <svg class="announcesvg" viewBox="0 0 24 24" role="presentation">74 <g stroke-width="2" fill="none" fill-rule="evenodd">75 <path d="M6.5 3.25l12 6" stroke="white"></path>76 <path stroke="white" d="M23 7l-10 5L1 6M13 12v11"></path>77 <path stroke="white" stroke-linecap="square" d="M23 7v10l-10 6-12-6V6l10-5z"></path>78 </g>79 </svg>80 Mas de 4823 pedidos entregados81 </div>82 </div>83 </div>84 <button class="barra-de-anuncio__nav barra-de-anuncio__nav--right">›</button>85 </div>86 </div>87</div>8889<style>90 .barra-de-anuncio {91 background: linear-gradient(60deg, #00B26C 0, #027548 15%, #00B26C 100%);92 background-size: 300% 100% !important;93 animation: 3.5s linear infinite featureAnimation;94 color: #ffffff;95 }9697 @keyframes featureAnimation {98 0% {99 background-position: 0;100 }101 50% {102 background-position: 150%;103 }104 100% {105 background-position: 300%;106 }107 }108109 .container {110 max-width: 1480px;111 margin-left: auto;112 margin-right: auto;113 padding: 0;114 }115 .barra-de-anuncio__inner {116 display: flex;117 align-items: center;118 justify-content: space-between;119 width: 100%;120 padding-bottom: 2px;121 }122 .barra-de-anuncio__slider {123 overflow: hidden;124 width: 80%;125 }126 .barra-de-anuncio__track {127 display: flex;128 transition: transform 0.5s ease;129 }130 .barra-de-anuncio__content {131 display: block;132 font-size: 15px;133 padding: 4px 0;134 margin-bottom: 0;135 flex: 0 0 33.3333%;136 text-align: center;137 box-sizing: border-box;138 }139 .announcesvg {140 width: 22px;141 vertical-align: middle;142 display: inline-block;143 margin-right: 10px;144 }145 .barra-de-anuncio__nav {146 background: none;147 border: none;148 color: white;149 font-size: 21px;150 cursor: pointer;151 margin-left: 15px;152 margin-right: 15px;153 }154 @media only screen and (max-width: 999px) {155 .barra-de-anuncio__content {156 flex: 0 0 100%;157 }158 .barra-de-anuncio__nav {159 margin-left: 5px;160 margin-right: 5px;161 }162 }163</style>164165<script>166 let currentIndex = 0;167168 function updateSliderPosition() {169 const sliderTrack = document.querySelector('.barra-de-anuncio__track');170 const slides = document.querySelectorAll('.barra-de-anuncio__content');171 const slideWidth = slides[0].clientWidth;172 sliderTrack.style.transform = `translateX(-${currentIndex * slideWidth}px)`;173 if (currentIndex >= slides.length / 2) { // Si llega al final del primer conjunto174 setTimeout(() => {175 currentIndex = 0; // Reiniciar el índice176 sliderTrack.style.transition = 'none';177 sliderTrack.style.transform = `translateX(0)`;178 setTimeout(() => {179 sliderTrack.style.transition = 'transform 0.5s ease';180 }, 50);181 }, 500); // Tiempo para que se complete la transición antes de reiniciar182 }183 }184185 function showNextSlide() {186 const slides = document.querySelectorAll('.barra-de-anuncio__content');187 currentIndex = (currentIndex + 1) % slides.length;188 updateSliderPosition();189 }190191 function showPrevSlide() {192 const slides = document.querySelectorAll('.barra-de-anuncio__content');193 currentIndex = (currentIndex - 1 + slides.length) % slides.length;194 updateSliderPosition();195 }196197 document.querySelector('.barra-de-anuncio__nav--right').addEventListener('click', showNextSlide);198 document.querySelector('.barra-de-anuncio__nav--left').addEventListener('click', showPrevSlide);199200 let sliderInterval = setInterval(showNextSlide, 4000);201202 document.querySelector('.barra-de-anuncio').addEventListener('mouseover', () => {203 clearInterval(sliderInterval);204 });205206 document.querySelector('.barra-de-anuncio').addEventListener('mouseout', () => {207 sliderInterval = setInterval(showNextSlide, 4000);208 });209210 document.querySelector('.barra-de-anuncio').addEventListener('mousedown', (e) => {211 e.preventDefault();212 const startX = e.pageX;213 document.addEventListener('mousemove', onMouseMove);214215 document.addEventListener('mouseup', () => {216 document.removeEventListener('mousemove', onMouseMove);217 });218219 function onMouseMove(event) {220 const offset = event.pageX - startX;221 if (offset > 50) {222 showPrevSlide();223 document.removeEventListener('mousemove', onMouseMove);224 } else if (offset < -50) {225 showNextSlide();226 document.removeEventListener('mousemove', onMouseMove);227 }228 }229 });230</script>231<!-- FINAL BARRA DE ANUNCIOS DINAMICA -->
How to install Announcement Bar 3 on your Shopify theme
This snippet belongs in sections/announcement-bar.liquid (or the top of layout/theme.liquid), directly above your header so it renders on every page. Expect the whole job to take about 15–25 minutes.
- 1From your Shopify admin, open Online Store → Themes, click the … button on your live theme and choose Duplicate. Always work on a copy so you can roll back instantly.
- 2On the duplicated theme, click … → Edit code to open the theme code editor.
- 3Open sections/announcement-bar.liquid (or the top of layout/theme.liquid) in the file tree. If your theme uses different file names, search for the template that renders the area where you want the block to show up.
- 4Click Copy code on this page, then paste the snippet directly above your header so it renders on every page.
- 5The snippet ships with its own scoped
<style>block, so you do not need to touchbase.cssortheme.css. If you prefer to keep CSS centralised, move the contents of the style tag into your theme stylesheet and delete the inline block. - 6Keep the
<script>tag at the end of the snippet. It only runs once the surrounding markup exists in the DOM, so moving it higher up the file can break the behaviour. - 7Click Save, then hit Preview and check the block on desktop, tablet and mobile widths.
- 8When you are happy with the result, publish the duplicated theme from Online Store → Themes → Actions → Publish.
How to customise it
Every value below lives inside the snippet, so you can adapt Announcement Bar 3 to your brand without touching the rest of the theme.
- Colours — the snippet uses
#ffffff,#00B26C,#027548. Replace those values inside the style block with your brand palette, keeping at least a 4.5:1 contrast ratio between text and background so the block stays accessible. - Gradient — swap the
linear-gradient(...)declaration for a flat background colour if you want a more minimal, theme-native look. - Sizing — adjust the font-size values (15px, 21px) and the padding so the block carries the same visual weight as the elements around it.
- Copy — rewrite the hard-coded text (for example “‹”) in your own brand voice, and translate it if you sell in more than one language.
- Timing — the countdown duration is set in the script. Change the target time or the interval value to control how long the offer runs before it resets.
- Responsive behaviour — the
@mediaquery defines the mobile breakpoint. Adjust the pixel value if your theme uses a different breakpoint scale.
Common mistakes to avoid
These are the issues merchants run into most often when installing a snippet like this one.
- Editing the live theme directly. Duplicate it first — a single unbalanced Liquid tag can take a storefront down mid-campaign.
- Pasting the code into the wrong file. Dropped into
layout/theme.liquidinstead ofsections/announcement-bar.liquid, this block will render on every page of the store, including ones where it makes no sense. - Renaming the CSS classes in the markup but not in the style block, or vice versa. The class names have to match exactly or the styling silently disappears.
- Adding the snippet twice on the same page. The script targets its selector, so two copies can conflict or double-fire.
- Running a countdown that resets on every page load and never actually expires. Shoppers notice fake urgency, and in the EU and UK it can breach consumer-protection rules.
- Publishing without testing on a real phone. Most Shopify traffic is mobile, and layout problems almost always surface there first.
Performance notes
What this block costs you in load time, and how to keep that cost at zero.
- The CSS is inline and scoped to this block, so it adds no extra network request. At a few kilobytes it has no measurable effect on your Lighthouse score.
- The JavaScript is vanilla — no jQuery, no external library, no additional request. Keep it after the markup so it never blocks rendering.
- The animation runs on CSS keyframes. Animate only transform and opacity where you can — animating width, height or top forces a layout recalculation on every frame.
- Run PageSpeed Insights before and after you add the block so you have a concrete number rather than a guess.
SEO & accessibility
How to add this block without damaging your on-page structure or your rich results.
- Nothing in this snippet should replace your page
<h1>. Keep product and page headings intact and use<h2>or<h3>for the block's own heading so the document outline stays clean. - If the block shows review or rating content, keep it consistent with the structured data your review app already outputs. Duplicating or contradicting rating markup can cost you the rich result entirely.
- The block does not create a new URL, so there is no canonical or indexing change to make. It improves on-page engagement signals rather than crawlability.
Announcement Bar 3 — questions merchants ask
Will this snippet work with my theme?
It is built with standard Liquid, HTML and CSS, so it works with Dawn and virtually every Online Store 2.0 theme, as well as most vintage themes. The only thing that changes between themes is the file you paste it into — if yours has no sections/announcement-bar.liquid, look for the equivalent template that renders the same area.
Do I need an app to use it?
No. This is theme code you own outright: no monthly fee, no third-party script tag, and no app that can break your storefront the next time it updates.
How long does it take to add “Announcement Bar 3” to a store?
Most merchants have it live in under fifteen minutes — duplicate the theme, paste the code, adjust the colours and copy, preview on mobile, publish.
The block appears but nothing happens. What is wrong?
That is almost always a script-order problem. Check that the script tag is still at the bottom of the snippet and that the markup was not pasted inside another script or a Liquid comment block. Open your browser console and look for an error naming the snippet's selector.
The styling looks broken after pasting. How do I fix it?
Confirm you copied the whole snippet including the closing style tag, then check whether one of your theme's own CSS rules is overriding it. If a theme rule wins, increase the specificity of the snippet's selector rather than scattering !important through the file.
Will it slow my store down?
Not meaningfully. It is inline markup with scoped CSS and at most a few lines of vanilla JavaScript — no external libraries, no extra HTTP request. Optimising your product images will always have a far bigger impact on load time.
Can I use it on a client store or a commercial project?
Yes. Every snippet in the MCO Hub library is free to copy, modify and ship on any store, including client work. Attribution is appreciated but not required.
Related snippets
Keep exploring
Guides
Templates
Deals & Discounts



