Html 设置手风琴菜单默认值以显示内容,而不是将其隐藏在液体中
在我的产品页面的侧栏上,有一个手风琴式菜单中的过滤器。 预览: 我正在尝试将“过滤器”的“手风琴”菜单默认为“取消隐藏/打开”,而不是默认为“关闭”Html 设置手风琴菜单默认值以显示内容,而不是将其隐藏在液体中,html,css,accordion,shopify,liquid,Html,Css,Accordion,Shopify,Liquid,在我的产品页面的侧栏上,有一个手风琴式菜单中的过滤器。 预览: 我正在尝试将“过滤器”的“手风琴”菜单默认为“取消隐藏/打开”,而不是默认为“关闭” {% comment %} *** FILTER BY *** {% endcomment %} {% if collection.products.size > 0 %} <h4 class="sidebar-title collapsed" data-toggle-target="sidebar-filter-group">
{% comment %} *** FILTER BY *** {% endcomment %}
{% if collection.products.size > 0 %}
<h4 class="sidebar-title collapsed" data-toggle-target="sidebar-filter-group">
Filter By
<i class="fa fa-angle-up" aria-hidden="true"></i>
</h4>
<div id="sidebar-filter-group" class="sidebar-group">
{% comment %} *** FILTER BY SIZE *** {% endcomment %}
{% assign size_tags = settings.collection_sidebar_size_tags | strip_newlines | replace: ' ,', ',' | replace: ', ', ',' | split: ',' %}
{% assign filters_selected_tags = '' %}
{% for size_tag in size_tags %}
{% assign tag_search = size_tag | replace: '-', ' ' %}
{% if current_tags contains tag_search %}
{% assign filters_selected_tags = filters_selected_tags | append: tag_search | append: ',' %}
{% endif %}
{% endfor %}
{% assign filters_selected_tags = filters_selected_tags | split: ',' %}
<div class="accordian-group" data-selected-count="{{ filters_selected_tags.size }}">
<div class="accordian-heading">
<a class="collapsed" href="#">{{ settings.collection_sidebar_size_title }}</a>
</div>
<div class="accordian-body">
{% if filters_selected_tags.size > 0 %}
{% assign current_tags_modifier = '' %}
{% for t in current_tags %}
{% unless filters_selected_tags contains t %}
{% assign h = t | handle %}
{% assign current_tags_modifier = current_tags_modifier | append: h | append: ',' %}
{% endunless %}
{% endfor %}
{% assign current_tags_modifier = current_tags_modifier | split: ',' | join: '+' %}
{% assign clear_selected_url = collection.url | append: '/' | append: current_tags_modifier %}
<div class="clear-selected">
<a href="{{ clear_selected_url }}">
<i class="fa fa-times-circle" aria-hidden="true"></i> Clear {{ settings.collection_sidebar_size_title }}
</a>
</div>
{% endif %}
<ul class="multi-select buttons">
{% for size_tag in size_tags %}
{% assign tag_name = size_tag %}
{% assign tag_search = tag_name | replace: '-', ' ' %}
{% capture link_html %}
{% if current_tags contains tag_search %}
{{ tag_name | link_to_remove_tag: tag_search }}
{% else %}
{{ tag_name | link_to_add_tag: tag_search }}
{% endif %}
{% endcapture %}
{% assign link_href = '' %}
{% assign link_html = link_html | escape %}
{% if link_html contains 'href="' %}
{% assign link_html = link_html | split: 'href="' %}
{% assign link_html = link_html[1] | split: '"' %}
{% assign link_href = link_html[0] %}
{% endif %}
{% if collection.tags contains tag_name %}
<li>
{% if current_tags contains tag_search %}
<a class="active" title="{{ tag_name }}" href="{{ link_href }}">{{ tag_name }}</a>
{% else %}
<a title="{{ tag_name }}" href="{{ link_href }}">{{ tag_name }}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% comment %} *** FILTER BY COLOR *** {% endcomment %}
{% assign color_tags = settings.collection_sidebar_color_tags | strip_newlines | replace: ' ,', ',' | replace: ', ', ',' | split: ',' %}
{% assign filters_selected_tags = '' %}
{% for color_tag in color_tags %}
{% assign tag_search = color_tag | replace: '-', ' ' %}
{% if current_tags contains tag_search %}
{% assign filters_selected_tags = filters_selected_tags | append: tag_search | append: ',' %}
{% endif %}
{% endfor %}
{% assign filters_selected_tags = filters_selected_tags | split: ',' %}
<div class="accordian-group" data-selected-count="{{ filters_selected_tags.size }}">
<div class="accordian-heading">
<a class="collapsed" href="#">{{ settings.collection_sidebar_color_title }}</a>
</div>
<div class="accordian-body">
{% if filters_selected_tags.size > 0 %}
{% assign current_tags_modifier = '' %}
{% for t in current_tags %}
{% unless filters_selected_tags contains t %}
{% assign h = t | handle %}
{% assign current_tags_modifier = current_tags_modifier | append: h | append: ',' %}
{% endunless %}
{% endfor %}
{% assign current_tags_modifier = current_tags_modifier | split: ',' | join: '+' %}
{% assign clear_selected_url = collection.url | append: '/' | append: current_tags_modifier %}
<div class="clear-selected">
<a href="{{ clear_selected_url }}">
<i class="fa fa-times-circle" aria-hidden="true"></i> Clear {{ settings.collection_sidebar_color_title }}
</a>
</div>
{% endif %}
<ul class="multi-select color-swatches">
{% for color_tag in color_tags %}
{% assign color_swatch_src = color_tag | handle | prepend: 'swatch-' | append: '_icon.png' %}
{% capture color_swatch %}
<div class="swatch-border">
<img src="{{ color_swatch_src | file_url }}" alt="{{ color_tag | escape }}" />
</div>
{% endcapture %}
{% assign tag_name = color_tag %}
{% assign tag_search = tag_name | replace: '-', ' ' %}
{% capture link_html %}
{% if current_tags contains tag_search %}
{{ tag_name | link_to_remove_tag: tag_search }}
{% else %}
{{ tag_name | link_to_add_tag: tag_search }}
{% endif %}
{% endcapture %}
{% assign link_href = '' %}
{% assign link_html = link_html | escape %}
{% if link_html contains 'href="' %}
{% assign link_html = link_html | split: 'href="' %}
{% assign link_html = link_html[1] | split: '"' %}
{% assign link_href = link_html[0] %}
{% endif %}
{% if collection.tags contains tag_name %}
<li>
{% if current_tags contains tag_search %}
<a class="active" title="{{ tag_name }}" href="{{ link_href }}">{{ color_swatch }}</a>
{% else %}
<a title="{{ tag_name }}" href="{{ link_href }}">{{ color_swatch }}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% comment %} *** FILTER BY PRICE *** {% endcomment %}
{% assign price_tags = settings.collection_sidebar_price_tags | strip_newlines | replace: ' ,', ',' | replace: ', ', ',' | split: ',' %}
{% assign filters_selected_tags = '' %}
{% for price_tag in price_tags %}
{% assign tag_search = price_tag | replace: '-', ' ' %}
{% if current_tags contains price_tag %}
{% assign filters_selected_tags = filters_selected_tags | append: price_tag | append: ',' %}
{% endif %}
{% endfor %}
{% assign filters_selected_tags = filters_selected_tags | split: ',' %}
<div class="accordian-group" data-selected-count="{{ filters_selected_tags.size }}">
<div class="accordian-heading">
<a class="collapsed" href="#">{{ settings.collection_sidebar_price_title }}</a>
</div>
<div class="accordian-body">
{% if filters_selected_tags.size > 0 %}
{% assign current_tags_modifier = '' %}
{% for t in current_tags %}
{% unless filters_selected_tags contains t %}
{% assign h = t | handle %}
{% assign current_tags_modifier = current_tags_modifier | append: h | append: ',' %}
{% endunless %}
{% endfor %}
{% assign current_tags_modifier = current_tags_modifier | split: ',' | join: '+' %}
{% assign clear_selected_url = collection.url | append: '/' | append: current_tags_modifier %}
<div class="clear-selected">
<a href="{{ clear_selected_url }}">
<i class="fa fa-times-circle" aria-hidden="true"></i> Clear {{ settings.collection_sidebar_price_title }}
</a>
</div>
{% endif %}
<ul class="multi-select list">
{% for price_tag in price_tags %}
{% assign tag_name = price_tag %}
{% assign tag_search = tag_name | replace: '-', ' ' %}
{% capture link_html %}
{% if current_tags contains tag_name %}
{{ tag_name | link_to_remove_tag: tag_name }}
{% else %}
{{ tag_name | link_to_add_tag: tag_name }}
{% endif %}
{% endcapture %}
{% assign link_href = '' %}
{% assign link_html = link_html | escape %}
{% if link_html contains 'href="' %}
{% assign link_html = link_html | split: 'href="' %}
{% assign link_html = link_html[1] | split: '"' %}
{% assign link_href = link_html[0] %}
{% endif %}
{% if collection.tags contains tag_name %}
<li>
{% if current_tags contains tag_name %}
<a class="active" title="{{ tag_name }}" href="{{ link_href }}">{{ tag_name }}</a>
{% else %}
<a title="{{ tag_name }}" href="{{ link_href }}">{{ tag_name }}</a>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% comment %} *** SORT BY *** {% endcomment %}
<div class="sidebar-sort">
<div class="accordian-group" data-selected-count="0">
<div class="accordian-heading">
<a class="collapsed" href="#">Sort By</a>
</div>
<div class="accordian-body">
{% include 'collection-toolbar' %}
</div>
</div>
</div>
</div>
{ % endif %}
{%comment%}***按***{%endcomment%}筛选
{%如果collection.products.size>0%}
过滤
{%comment%}***按大小筛选***{%endcomment%}
{%assign size_tags=settings.collection_side bar_size_tags | strip_newlines | replace:'、'、'、'、'| replace:'、'、'、'拆分:'、'%}
{%assign filters\u selected\u tags=''%}
{size_标记%中的size_标记为%1}
{%assign tag_search=size_tag | replace:'-','%}
{%如果当前的\u标记包含标记\u搜索%}
{%assign filters_selected_tags=filters_selected_tags | append:tag_search | append:','%}
{%endif%}
{%endfor%}
{%assign filters_selected_tags=filters_selected_tags | split:','%}
{%if filters_selected_tags.size>0%}
{%assign current_tags_modifier='''%}
{t在当前_标记%中的百分比}
{%除非过滤器\所选\标记包含t%}
{%assign h=t | handle%}
{%assign current_tags_modifier=current_tags_modifier | append:h | append:','%}
{%end除非%}
{%endfor%}
{%assign current_tags_modifier=current_tags_modifier | split:','| join:'+'%}
{%assign clear_selected_url=collection.url | append:'/'| append:current_tags_modifier%}
{%endif%}
{size_标记%中的size_标记为%1}
{%assign tag\u name=size\u tag%}
{%assign tag_search=tag_name | replace:'-','%}
{%capture link_html%}
{%如果当前的\u标记包含标记\u搜索%}
{{tag_name | link_to_remove_tag:tag_search}
{%else%}
{{tag_name | link_to_add_tag:tag_search}
{%endif%}
{%endcapture%}
{%assign link_href=''%}
{%assign link_html=link_html | escape%}
{%如果链接_html包含'href=“”%}
{%assign link_html=link_html | split:'href=“”'%}
{%assign link_html=link_html[1]| split:“%”
{%assign link\u href=link\u html[0]}
{%endif%}
{%if collection.tags包含标记\u name%}
-
{%如果当前的\u标记包含标记\u搜索%}
{%else%}
{%endif%}
{%endif%}
{%endfor%}
{%comment%}***按颜色筛选***{%endcomment%}
{%assign color_tags=settings.collection_sidebar_color_tags | strip_newlines | replace:'、'、'、'、'| replace:'、'、'、'分割:'、'%}
{%assign filters\u selected\u tags=''%}
{color_tags%中的color_tags%为%
{%assign tag_search=color_tag | replace:'-','%}
{%如果当前的\u标记包含标记\u搜索%}
{%assign filters_selected_tags=filters_selected_tags | append:tag_search | append:','%}
{%endif%}
{%endfor%}
{%assign filters_selected_tags=filters_selected_tags | split:','%}
{%if filters_selected_tags.size>0%}
{%assign current_tags_modifier='''%}
{t在当前_标记%中的百分比}
{%除非过滤器\所选\标记包含t%}
{%assign h=t | handle%}
{%assign current_tags_modifier=current_tags_modifier | append:h | append:','%}
{%end除非%}
{%endfor%}
{%assign current_tags_modifier=current_tags_modifier | split:','| join:'+'%}
{%assign clear_selected_url=collection.url | append:'/'| append:current_tags_modifier%}
{%endif%}
{color_tags%中的color_tags%为%
{%assign color_-swatch_src=color_-tag | handle | prepend:'swatch-'| append:'_-icon.png%}
{%capture color_swatch%}
{%endcapture%}
{%assign tag\u name=color\u tag%}
{%assign tag_search=tag_name | replace:'-','%}
{%capture link_html%}
{%如果当前的\u标记包含标记\u搜索%}
{{tag_name | link_to_remove_tag:tag_search}
{%else%}
{{tag_name | link_to_add_tag:tag_search}
{%endif%}
{%endcapture%}
{%assign link_href=''%}
{%assign link_html=link_html | escape%}
{%如果链接_html包含'href=“”%}
{%assign link_html=link_html | split:'href=“”'%}
{%assign link_html=link_html[1]| split:“%”
{%assign link\u href=link\u html[0]}
{%endif%}
{%if collection.tags包含标记\u name%}
-
{%如果当前的\u标记包含标记\u搜索%}
{%else%}
{%endif%}
{%endif%}
{%endfor%}
{%comment%}***按价格筛选***{%endcomment%}
{%assign price_tags=settings.collection_sidebar_price_tags | strip_newlines | replace:'、'、'、'、'| replace:'、'、'、'拆分:'、'%}
{%assign filters\u selected\u tags=''%}
{price_tags%}中price_tag的百分比为%
{%assign tag_search=price_tag|replace:'-','%}
{%如果当前_标记包含价格_标记%}
{%assign filters_selected_tags=filters_selected_tags | append:price_tag | append:','%}
{%endif%}
{%endfor%}
{%assign filters_selected_tags=filters_selected_tags | split:','%}
{%if filters_selected_tags.size>0%}
.accordion-body {
display: block;
}
<div class="accordion-body">
<div class="accordion-body visible">