我要做的是,当您在侧边栏中选择过滤器时(通过单击绿色按钮“ Filtro”出现),侧边栏将关闭以显示过滤器的结果。
这是sidebar-tag-filters.liquid:
{% if section.blocks.size > 0 %}
{% for block in section.blocks %}
{% if block.settings.enable_shop_by_tags %}
{% if block.settings.shop_by_tags_title != blank %}
<aside class="sidebar-tag filter tags {{ block.settings.shop_by_tags_title | downcase }} {{forloop.index}}">
{% assign tags = block.settings.shop_by_tags_list | split: ',' %}
<div class="widget{% if block.settings.default_view == 'closed' %} click{% endif %}">
<h4>
<span>{{ block.settings.shop_by_tags_title }} </span>
<a href="javascript:void(0)" class="clear" style="display:none">
<i class="zmdi zmdi-close"></i>
</a>
</h4>
<div class="widget-content"{% if block.settings.default_view == 'closed' %} style="overflow: hidden; display: none;"{% endif %}>
<ul>
{% assign counter = 0 %}
{% for t in tags %}
{% assign tag = t | strip %}
{% assign tag_value = tag | handleize %}
{% if current_tags contains tag %}
<li>
<i></i>
<input type="checkbox" value="{{ tag_value }}" checked/>
<label>{{ tag }}</label>
</li>
{% else %}
<li>
<i></i>
<input type="checkbox" value="{{ tag_value }}"/>
<label>{{ tag }}</label>
</li>
{% assign counter = counter | plus:1 %}
{% endif %}
{% endfor %}
{% if counter == 0 %}<script>$('.sidebar-tag.{{forloop.index}}').hide();</script>{% endif %}
</ul>
</div>
</div>
</aside>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
我认为我需要添加{%,如果counter == 1%} 并尝试了一下,但是由于Java语言不是我的领域,所以谢谢任何回答。