Last active
November 19, 2015 14:45
-
-
Save richgcook/d848f33e80e8d9dd05a5 to your computer and use it in GitHub Desktop.
Active body/menu links
This file contains hidden or 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
| $('ul.navigation-list li, ul.tag-list li').each(function() { | |
| var classes = this.classList; | |
| for (var i=0,len=classes.length; i<len; i++) { | |
| if ($('body').hasClass(classes[i])) { | |
| $(this).addClass('active'); | |
| } | |
| } | |
| }); | |
| $('.menu-section-container ul li').each(function() { | |
| var class_attr = $(this).attr('class'); | |
| if ( class_attr != undefined ) { | |
| var classes = class_attr.split(/\s+/); | |
| for (var i=0,len=classes.length; i<len; i++) { | |
| if ($('body').hasClass(classes[i])) { | |
| $(this).addClass('active'); | |
| } | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment