Shopify themes, liquid, logos, and UX
Hi All,
I have the following code in Impulse theme within toolbar.liquid where I have toolbar_menu items and based on click I want to attach an active class. I have been trying to use link.current property to keep track but no class gets added upon inspection. Below is the code snippet within toolbar.liquid:
{% if section.settings.toolbar_menu != blank %}
<div class="toolbar__item toolbar__item--menu">
<ul class="inline-list toolbar__menu">
{% for link in toolbar_menu.links %}
<li>
<a href="{{ link.url }}" {% if link.current %}aria-current="page" class="active" style="color:yellow;"{% endif %}>{{ link.title }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
@rjtbansal wrote:Hi All,
I have the following code in Impulse theme within toolbar.liquid where I have toolbar_menu items and based on click I want to attach an active class. I have been trying to use link.current property to keep track but no class gets added upon inspection. Below is the code snippet within toolbar.liquid:
{% if section.settings.toolbar_menu != blank %}
<div class="toolbar__item toolbar__item--menu">
<ul class="inline-list toolbar__menu">
{% for link in toolbar_menu.links %}
<li>
<a href="{{ link.url }}" {% if link.current %}aria-current="page" class="active" style="color:yellow;"{% endif %}>{{ link.title }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="">
<ul class="menu">
{% for link in linklists['main-menu'].links %}
<li>
<a href="{{ link.url }}" {% if link.current == true %}class="active" {% endif %}>{{ link.title }}</a>
</li>
{% endfor %}
</ul>
</div>
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024