Hi,
The element is a deprecated HTML tag. If you use it, your pages or apps may be broken. To make the announcement bar to scroll, you need to modify the announcement bar coding.
If you don’t have knowledge of css & liquid coding, you may copy the code below and replace your announcement-bar.liquid under Sections.
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'announcement' -%}
{%- if block.settings.text != blank -%}
{%- if block.settings.link != blank -%}
{%- endif -%}
{{ block.settings.text | escape }}
{%- if block.settings.link != blank -%}
{% render 'icon-arrow' %}
{%- endif -%}
{%- if block.settings.link != blank -%}
{%- endif -%}
{%- endif -%}
{%- endcase -%}
{%- endfor -%}
{% style %}
.announcement-bar__message {
text-align: right !important;
}
@-webkit-keyframes scroll{
0% {
margin-right: 0%;
}
100% {
margin-right: 100%;
}
}
.scroll-box {
display: inline-flex;
justify-content: center;
white-space: nowrap;
font-size: 1.1em;
overflow: hidden;
width: 100%;
background: rgb(var(--color-background));
background: var(--gradient-background);
}
@media screen and (min-width: 768px) {
.scroll-container {
width: 50%;
direction: rtl;
margin-left: 120px;
overflow: hidden;
}
}
@media screen and (max-width: 767px) {
.scroll-container {
width: 100%;
direction: rtl;
margin-left: 24px;
overflow: hidden;
}
}
#scroll-element {
padding: 10px;
}
{% endstyle %}
{% schema %}
{
"name": "t:sections.announcement-bar.name",
"max_blocks": 12,
"blocks": [
{
"type": "announcement",
"name": "t:sections.announcement-bar.blocks.announcement.name",
"settings": [
{
"type": "text",
"id": "text",
"default": "Welcome to our store",
"label": "t:sections.announcement-bar.blocks.announcement.settings.text.label"
},
{
"type": "select",
"id": "color_scheme",
"options": [
{
"value": "accent-1",
"label": "t:sections.all.colors.accent_1.label"
},
{
"value": "accent-2",
"label": "t:sections.all.colors.accent_2.label"
},
{
"value": "background-1",
"label": "t:sections.all.colors.background_1.label"
},
{
"value": "background-2",
"label": "t:sections.all.colors.background_2.label"
},
{
"value": "inverse",
"label": "t:sections.all.colors.inverse.label"
}
],
"default": "accent-1",
"label": "t:sections.all.colors.label"
},
{
"type": "url",
"id": "link",
"label": "t:sections.announcement-bar.blocks.announcement.settings.link.label"
}
]
}
],
"default": {
"blocks": [
{
"type": "announcement"
}
]
}
}
{% endschema %}
The following elements are modified.
-
added scroll-box class in the first div
-
created second div with scroll-container class within scroll-box div
-
added scroll-element id in announcement-bar message
-
added necessary css style within the announcement-bar.liquid
-
added necessary javascript within the announcement-bar.liquid
You may change the scroll speed from above code.
To change the scroll speed, please change the number in the code from 120 to 80 or 160 per your needs.
var time = elemWidth/120; /* lower number for slow & higher number for fast scroll */
To change the scroll area width, you may change the width 50% to different number.
@media screen and (min-width: 768px) {
.scroll-container {
width: 50%; /* Change this number for scroll area width */
direction: rtl;
margin-left: 120px; /* You may also change this number for left margin of the scroll area */
overflow: hidden;
}
}
If you have any questions, please let me know.
Hope it helps.
Thanks.