Skip to content

Instantly share code, notes, and snippets.

@fredryk
Created September 27, 2013 16:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredryk/6731593 to your computer and use it in GitHub Desktop.
Save fredryk/6731593 to your computer and use it in GitHub Desktop.
Updated Simple theme drop-down navigation
<ul id="main-menu" class="accordion">
{% for link in linklists.main-menu.links %}
{% assign has_sub_menu = false %}
{% assign parent_link_active = false %}
{% assign child_list_handle = link.title | handle %}
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %}
{% assign has_sub_menu = true %}
{% for l in linklists[child_list_handle].links %}
{% if l.active %}
{% assign parent_link_active = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if has_sub_menu %}
<li>
<a href="#" class="accordion-button">{{ link.title }}
<span>{% if link.active or parent_link_active %}-{% else %}+{% endif %}</span>
</a>
<div class="accordion-content" {% unless parent_link_active %}style="display:none"{% endunless %} >
{% for l in linklists[child_list_handle].links %}
<a href="{{ l.url }}" {% if l.active %}class="active"{% endif %}>{{ l.title }} </a>
{% endfor %}
</div>
</li>
{% else %}
<li><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endif %}
{% endfor %}
</ul>
@mustafaozcaninfo
Copy link

Mustafa Özcan

Kişisel Blog makalelerimi SEO konusundaki deneyimleri paylaştığım blogum.Fırsatları ayağınıza getiren mustafa ozcan blog kişisel temalı yazılar ile gündemde yer alan güncel yazıları sizlere sunma fırsatı ile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment