Forked from dsadhanala/Jade: list iteration on a object
Last active
August 29, 2015 14:10
-
-
Save jrosadocruz/5c7b6723b946264c46ed to your computer and use it in GitHub Desktop.
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
//- compile and see the output online at below URL | |
http://jade-lang.com/ | |
//- navigation data | |
-var navLinks = { 'Home': 'home.html', 'About': 'about.html', 'Services': 'services.html', 'Contact': 'contact.html'}; | |
//- set default selected item (useful for adding active state for current page navigation link in each page) | |
- var activeLink = 'Home'; | |
nav(role="navigation" aria-label="Primary") | |
ul.site-primary-nav | |
//- iterator | |
each val, key in navLinks | |
li.nav__link | |
//- check for acive link and add class | |
if activeLink === key | |
- activeLink = "nav__link-active" | |
else | |
- activeLink = "" | |
//- populate links | |
a(href=val class="#{activeLink}")= key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment