手风琴折叠菜单思路shopify liquid

释放双眼,带上耳机,听听看~!
{%- for link in section.settings.menu.links -%}
    <accordion-disclosure class="accordion">
      {% assign link_title_downcase = link.title | downcase %}
      {% assign page_title_downcase = collection.title | downcase %}
      {% assign should_expand = false %}
      
      {% for child_link in link.links %}
        {% assign child_title_downcase = child_link.title | downcase %}
        {% if child_title_downcase == page_title_downcase %}
          {% assign should_expand = true %}
          {% break %}
        {% endif %}
      {% endfor %}
      {% comment %}子菜单名字与页面一样是为真{% endcomment %}

      <details class="accordion__disclosure group" {{ page_title_downcase }} {% if link_title_downcase == page_title_downcase or should_expand %}open aria-expanded="true"{% else %}aria-expanded="false"{% endif %}>
        <summary>
          <span class="accordion__toggle h6">
            <span><a href="{{ link.url }}">{{ link.title }}</a></span>
            <span class="animated-plus group-expanded:rotate" aria-hidden="true"></span>
          </span>
        </summary>
  
        <div class="accordion__content">
          {%- if link.links != blank -%}
            <ul class="v-stack gap-2.5 unstyled-list">
              {%- for child_link in link.links -%}
                <li>
                  <a class="link-faded h6" href="{{ child_link.url }}">{{ child_link.title }}</a>
                </li>
              {%- endfor -%}
            </ul>
          {%- endif -%}
        </div>
      </details>
    </accordion-disclosure>
  {%- endfor -%}

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
Shopify主题开发Shopify功能开发

Shopify模板页面类型page_type

2024-6-19 0:10:42

Shopify常见问题独立站教程

Shopify预测搜索predictive search不能使用问题

2024-1-3 15:30:06

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索