How to get parent element using liquid?

Excursionist
23 0 1

Hi,

 

I want to tweak navmenu.liquid in order to not include a CSS class when it's mobile menu.

More specifically I want to find a good condition for the following if statement:

class="navmenu-link 
{% if ____WANTED_CONDITiON_TO_AVOID_MOBILE____ %}navmenu-link-parent{% endif %}
{% if link.active %}navmenu-link--active{% endif %}"

 

In navmenu.liquid this is all I can get:

{% comment %}
  @param menu LinkedList
         The menu handle to look up.

  @param depth Number
         The starting depth to use for the class names.

  @param max_depth Number
         The maximum depth to traverse.

  @param is_submenu Bool
         Add submenu classes

  @param is_site_nav Bool
         Determine whether original nav is site-navigation

  @param has_triggers Bool
         Adds in subnav triggers

  @param submenu_arrows Bool
         Option to display dropdown arrows

  @param aria_expanded Bool
         a11y helper

  @param sub_menu_title String
         Menu title must be passed if is submenu
{% endcomment %}

 

In theme.scss.liquid I have the corresponding CSS rule that does the job of not showing it:

@media only screen and (min-width: 1024px) {
	.site-navigation li:hover > ul { display: block; } 
}

But I am looking for a statement in order to make it not apply the class.

Any ideas?

 

Thanks a lot for your time!

 

0 Likes