Skip to content

Instantly share code, notes, and snippets.

@dsadhanala
Last active August 11, 2016 10:28
Show Gist options
  • Save dsadhanala/aef4b00313ff7f4716cb to your computer and use it in GitHub Desktop.
Save dsadhanala/aef4b00313ff7f4716cb to your computer and use it in GitHub Desktop.
//- compile and see the output online at below URL
http://jade-lang.com/
-var menu = [{link_icon: 'icon sample1', link_text: 'Link1', link_url : 'link1.html'},{link_icon: 'icon sample2', link_text: 'Link2', link_url : 'link2.html'}, {link_icon: 'icon sample3', link_text: 'Link2', link_url : 'link2.html'}];
- var menuactive = "";
//- add page level variable "page.mpMenuSelected"
- var mpMenuSelected = "Link1";
.menu
each item, i in menu
if mpMenuSelected === item.link_text
- mpmenuactive = 'is-active'
else
- mpmenuactive = ''
.menu--item
a(class="#{mpmenuactive}" href=item.link_url)
span(class="#{item.link_icon}")
span.menu--item-text= item.link_text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment