Liquid, Javascript
Tengo dos menus. El "main-menu" y uno llamado "menu2".
Mi header tiene una barra de navegación.
Quiero que cuando la página esté en modo escritorio, la barra de navegación de mi header tenga el menu "menu2".
Quiero que cuando la página esté en modo mobile, la barra de navegación de mi header tenga el menu "main-menu".
Podrían darme una mano?
Gracias!
Este es el fragmento de código que considero yo que es donde está el problema. Se encuentra al comienzo del archivo "adv-site-nav.liquid":
{% comment %}
List out your main-menu linklist (default)
More info on linklists:
- http://docs.shopify.com/themes/liquid-variables/linklists
{% endcomment %}
<ul class="site-nav checking">
{%- assign sitemenu = section.settings.pick_menu %}
{% for link in linklists[sitemenu].links %}
{% assign i = forloop.index | downcase %}
{% assign cat = link.title | handleize %}
Supongo que lo que quiero es que "sitemenu" sea igual a menu2 cuando se está en modo escritorio y que "sitemenu" sea igual a main-menu cuando se está en modo mobile.
Sin embargo, es probable que el error no se encuentre ahí.
Hola,
¿Podrías compartir el código completo de "adv-site-nav.liquid"?
Un saludo.
Si, claro!
{% comment %}
List out your main-menu linklist (default)
More info on linklists:
- http://docs.shopify.com/themes/liquid-variables/linklists
{% endcomment %}
<ul class="site-nav checking">
{%- assign sitemenu = section.settings.pick_menu %}
{% for link in linklists[sitemenu].links %}
{% assign i = forloop.index | downcase %}
{% assign cat = link.title | handleize %}
{% if section.settings.display_megamenu %}
{% assign is_megamenu = false %}
{% for block in section.blocks %}
{% for i in (1..7) %}
{% capture cap_megamenu_item %}megamenu_items_{{ i }}{% endcapture %}
{% capture cap_banner_first_style %}banner_first_style_{{ i }}{% endcapture %}
{% capture cap_link_banner_first_style %}link_banner_first_style_{{ i }}{% endcapture %}
{% capture cap_banner_second_style %}banner_second_style_{{ i }}{% endcapture %}
{% capture cap_link_banner_second_style %}link_banner_second_style_{{ i }}{% endcapture %}
{% capture cap_banner_third_style %}banner_third_style_{{ i }}{% endcapture %}
{% capture cap_link_banner_third_style %}link_banner_third_style_{{ i }}{% endcapture %}
{% if block.settings[cap_megamenu_item] != blank %}
{% assign megamenu_item = block.settings[cap_megamenu_item] | handleize %}
{% if megamenu_item == cat %}
{% assign is_megamenu = true %}
{% assign block_style = block.type %}
{%- assign title_featured_product = block.settings.title_featured_product -%}
{%- assign featured_product = block.settings.featured_product -%}
{%- assign product = all_products[featured_product] -%}
{%- assign banner_first_style = block.settings[cap_banner_first_style] -%}
{%- assign link_banner_first_style = block.settings[cap_link_banner_first_style] -%}
{%- assign banner_second_style = block.settings[cap_banner_second_style] -%}
{%- assign link_banner_second_style = block.settings[cap_link_banner_second_style] -%}
{%- assign banner_third_style = block.settings[cap_banner_third_style] -%}
{%- assign link_banner_third_style = block.settings[cap_link_banner_third_style] -%}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
{% if section.settings.enable_sale %}
{% assign sale_item = section.settings.sale_item | split:"," | strip | downcase | handle %}
{% assign sale = link.title | downcase | handle %}
{% endif %}
{% if section.settings.enable_new %}
{% assign new_item = section.settings.new_item | split:"," | strip | downcase | handle %}
{% assign new = link.title | downcase | handle %}
{% endif %}
{% if section.settings.enable_hot %}
{% assign hot_item = section.settings.hot_item | split:"," | strip | downcase | handle %}
{% assign hot = link.title | downcase | handle %}
{% endif %}
<li class="menu-lv-1 item{% if linklists[link.handle] != empty or block_style == "style_7" %} dropdown{% if is_megamenu or block_style == "style_7" %} mega-menu{% else %} no-mega-menu{% endif %}{% endif %}">
<a class="{%if linklists[link.handle] != empty %}menu__moblie {% endif %}{% if link.active %}current{% endif %}" href="{{ link.url }}">
{{ link.title }}
{% if linklists[link.handle] != empty %}
<span class="icon-dropdown" data-toggle-menu-mb>
<i class="fa fa-angle-right" aria-hidden="true"></i>
</span>
{% endif %}
{% if block_style == "style_7" %}
<span class="icon-dropdown" data-toggle-menu-mb>
<i class="fa fa-angle-right" aria-hidden="true"></i>
</span>
{% endif %}
{% if sale_item contains sale %}
<label class="icon-label icon_sale">
{{ section.settings.lb_sale }}
</label>
{% endif %}
{% if new_item contains new %}
<label class="icon-label icon_new">
{{ section.settings.lb_new }}
</label>
{% endif %}
{% if hot_item contains hot %}
<label class="icon-label icon_hot">
{{ section.settings.lb_hot }}
</label>
{% endif %}
</a>
{% if linklists[link.handle] != empty %}
<div class="sub-menu-mobile menu-mb-translate">
<div class="menu-mb-title">
<span class="icon-dropdown">
<i class="fa fa-angle-left" aria-hidden="true"></i>
</span>
{{ link.title }}
</div>
{% comment %}
Check if menu item is Mega menu
{% endcomment %}
{% assign link_child = link.handle %}
{% if section.settings.display_megamenu and is_megamenu %}
<div class="site-nav-dropdown {{ block_style }}">
<div class="container">
{% include 'mega-menu' with link_child %}
</div>
</div>
{% else %}
{% if linklists[link.handle] != empty %}
{% include 'adv-dropdown' with link_child %}
{% endif %}
{% endif %}
</div>
{% endif %}
{% if block_style == "style_7" %}
<div class="sub-menu-mobile menu-mb-translate">
<div class="menu-mb-title">
<span class="icon-dropdown">
<i class="fa fa-angle-left" aria-hidden="true"></i>
</span>
{{ link.title }}
</div>
<div class="site-nav-dropdown {{ block_style }}">
<div class="container">
{% include 'mega-menu' %}
</div>
</div>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
¿Alguna vez has creado una colección y has tenido problemas para añadir tus productos a...
By Ann Sep 10, 2024Una de las cosas que más presión genera a la hora de emprender con un negocio es conver...
By Teo Aug 20, 2024¿Alguna vez has visitado una página web lenta con imágenes pixeladas? ¿Qué haces cuando...
By Ann Aug 13, 2024