-
-
Save carolineschnapp/f95b1e4d0f9401ce6d20 to your computer and use it in GitHub Desktop.
Dropdown menus that handle Japanese / Chinese
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav role="navigation"> | |
<ul id="nav"> | |
{% for link in linklists.main-menu.links %} | |
{% assign has_drop_down = false %} | |
{% assign child_list_handle = link.title | handle %} | |
{% comment %}If the link uses the arabic, hebrew or cyrillic alphabet, or is in Chinese or Japanese, the handle will be empty.{% endcomment %} | |
{% if child_list_handle == '' %} | |
{% for i in (0..8) %} | |
{% unless has_drop_down %} | |
{% if forloop.first %} | |
{% assign temp = 'link-list' %} | |
{% else %} | |
{% capture temp %}link-list-{{ i }}{% endcapture %} | |
{% endif %} | |
{% if linklists[temp] and linklists[temp].links.size > 0 and linklists[temp].title == link.title %} | |
{% assign has_drop_down = true %} | |
{% assign child_list_handle = temp %} | |
{% endif %} | |
{% endunless %} | |
{% endfor %} | |
{% else %} | |
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %} | |
{% assign has_drop_down = true %} | |
{% endif %} | |
{% endif %} | |
<li class="nav-item{% if forloop.first %} first{% elsif forloop.last %} last{% endif %}{% if link.active %} active{% endif %}{% if has_drop_down %} dropdown{% endif %}"> | |
<a class="nav-item-link smooth" href="{{ link.url }}"> | |
{{ link.title }} | |
</a> | |
{% if has_drop_down %} | |
<ul class="sub-nav"> | |
<li class="sub-nav-niblet"></li> | |
{% for l in linklists[child_list_handle].links %} | |
<li class="sub-nav-item{% if forloop.first %} first{% elsif forloop.last %} last{% endif %}"> | |
<a class="sub-nav-item-link {% if forloop.first %}first{% endif %} {% if forloop.last %}last{% endif %}" href="{{ l.url }}">{{ l.title }}</a> | |
</li> | |
{% endfor %} | |
</ul> | |
{% endif %} | |
</li> | |
{% endfor %} | |
</ul> | |
</nav> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am not a professional programmer. Can you help where should put this code.