Create a new snippet and paste the code into it. Then, in blocks/_header-menu.liquid, replace {%- render ‘header-menu’ %} with the new snippet. It will work.
{% liquid
assign menu = block.settings.menu
%}
-
{% for link in menu.links %}
-
{{ link.title }}
{% if link.links != blank %}
{% endif %}
{% if link.links != blank %}
{% endif %}
-
{% for childlink in link.links %}
- {{ childlink.title }} {% endfor %}
{% endfor %}
{% stylesheet %}
.menu-list__list {
gap: 20px;
font-weight: 700;
}
.menu-list__list-item {
position: relative;
}
.menu-list__dropdown {
position: absolute;
top: 100%;
left: 0;
min-width: 200px;
background: var(–color-background);
border: 1px solid var(–color-border);
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
opacity: 0;
visibility: hidden;
transform: translateY(10px);
transition: all 0.3s ease;
z-index: 1000;
}
.menu-list__list-item:hover .menu-list__dropdown {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.menu-list__dropdown-list {
list-style: none;
padding: 8px 0;
margin: 0;
}
.menu-list__dropdown-link {
display: block;
padding: 8px 16px;
color: var(–color-foreground);
text-decoration: none;
transition: background-color 0.2s ease;
}
.menu-list__dropdown-link:hover {
background-color: var(–color-background-hover);
}
.menu-list__dropdown-link–active {
font-weight: bold;
}
.icon-caret {
display: inline-block;
margin-left: 4px;
width: 12px;
height: 12px;
vertical-align: middle;
}
{% endstylesheet %}