Loading
Copy-paste a theme-editor section for headers & navigation - A dismissible top-of-page message with configurable text, link and colours.
Free delivery on orders over $75
{%- if section.settings.text != blank -%} <div class="gpl-announcement" role="region" aria-label="Announcement" style="--gpl-bg: {{ section.settings.bg }}; --gpl-fg: {{ section.settings.fg }};"> {%- if section.settings.link != blank -%} <a href="{{ section.settings.link }}">{{ section.settings.text | escape }}</a> {%- else -%} <p>{{ section.settings.text | escape }}</p> {%- endif -%} <button type="button" class="gpl-announcement__close" aria-label="Dismiss announcement">×</button> </div>{%- endif -%} {% schema %}{ "name": "Announcement bar", "settings": [ { "type": "text", "id": "text", "label": "Message", "default": "Free delivery on orders over $75" }, { "type": "url", "id": "link", "label": "Link (optional)" }, { "type": "color", "id": "bg", "label": "Background", "default": "#0b1220" }, { "type": "color", "id": "fg", "label": "Text colour", "default": "#c8f542" } ], "presets": [{ "name": "Announcement bar" }]}{% endschema %} {% stylesheet %}.gpl-announcement { position: relative; background: var(--gpl-bg); color: var(--gpl-fg); padding: 0.6rem 2.5rem; text-align: center; font-size: 0.875rem;}.gpl-announcement a,.gpl-announcement p { color: inherit; margin: 0; }.gpl-announcement a { text-decoration: underline; }.gpl-announcement__close { position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%); background: none; border: 0; color: inherit; font-size: 1.25rem; cursor: pointer;}{% endstylesheet %} {% javascript %}document.querySelectorAll('.gpl-announcement').forEach((bar) => { if (sessionStorage.getItem('gpl-announcement') === 'closed') { bar.hidden = true; return; } const close = bar.querySelector('.gpl-announcement__close'); if (close) { close.addEventListener('click', () => { bar.hidden = true; sessionStorage.setItem('gpl-announcement', 'closed'); }); }});{% endjavascript %}