Skip to content

Instantly share code, notes, and snippets.

@schaeken
Last active August 29, 2015 14:12
Show Gist options
  • Save schaeken/736830a710a0e2277fef to your computer and use it in GitHub Desktop.
Save schaeken/736830a710a0e2277fef to your computer and use it in GitHub Desktop.
A basic mobile dropdown menu for shopify stores
{% assign found_active_link = false %}
<select name="main_navigation" id="main_navigation" class="fl">
{% for link in linklists.main-menu.links %}
{% if link.active %}
<option value="{{ link.url }}" selected="selected">{{ link.title }}</option>
{% assign found_active_link = true %}
{% else %}
<option value="{{ link.url }}">{{ link.title }}</option>
{% endif %}
{% for childlink in linklists[link.handle].links %}
{% if childlink.active %}
<option value="{{ childlink.url }}" selected="selected">- {{ childlink.title }}</option>
{% assign found_active_link = true %}
{% else %}
<option value="{{ childlink.url }}">- {{ childlink.title }}</option>
{% endif %}
{% endfor %}
{% endfor %}
{% unless found_active_link %}
<option value="" selected="selected">{{ page_title }}</option>
{% endunless %}
<option value="/cart">Your cart ({{ cart.item_count }})</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment