Created
January 12, 2016 14:53
-
-
Save agragregra/47fa85e5ce4ea258fe6a to your computer and use it in GitHub Desktop.
jQuery active menu
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
var url = window.location.pathname, | |
urlRegExp = new RegExp(url.replace(/\/$/,"") + "$"); | |
$(".box-mnu a").each(function(){ | |
if(urlRegExp.test(this.href.replace(/\/$/,""))){ | |
$(this).addClass("active"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment